Exception when setting RequiredFields


Author
Message
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I'm getting the following error for one of my BO's when I try to set the RequiredFields property:

"An error occurred while attempting to load this type editor:
Exception has been thrown by the target of an invocation."

I can map it without error through the BO Mapper and I have created several other BO's without problems.  What could cause something like this?

Replies
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
It compiles fine and I even used it as a reference in another project.  I just can't get to the required fields.  I'm having the issue only with one other BO at this time.  I'm attaching the projects I'm having problems with and maybe you can tell me if I've done something wrong.  I followed the same steps I've taken to create a lot of other BOs, but these don't seem to work like the rest.
Attachments
ReqFieldsException.zip (171 views, 110.00 KB)
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The reason it's throwing an exception is that you're filling the business object within the constructor.  When you are in the designer, all code within the constructor is executed at design-time because the designer creates instances of the objects at design-time.  When your objects are created, they're trying to fill themselves, and since the DataSource("") is the data source being used by StrataFrame, it cannot find your tables, and therefore cannot fill the business object at design-time.  Your best solution is to remove the FillDataTable method from the constructor and do one of two things: 1) Create a Shared "factory" method that will create new instances of the business objects and fill them before returning their references, or 2) Just manually call the FillDataTable method after the object is created.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search