Business binding Source and multiple business objects (IBindingList)


Author
Message
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
BBS wraps the instance of the business Object. The IBindingList interface expected a unique instance of an object for each... As  explained in the post (BBS and Multiple Business Objects.)

http://forum.strataframe.net/Topic14209-10-1.aspx?Highlight=Business+Binding+Source

After I've filled the business Object and I've seen CurrentDataTableRefilled event fired many times also.

I have to be careful because Constructor fires many times, CurrentDataTableRefilled event fires many times.

I'm writing code and think twice. (Normal business logic + explore BBS effects)

I expect there must be more resources (help + samples ) about this topic.

Could you give us more information ?  

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, the BBS creates a new instance of the business object to return for each "item" in the IBindingList that is returned for binding.  So, if your business object has 10 items in it, and you set the bo to the BBS.BusinessObject property and then bind the BBS to a grid, 11 total business objects will be created.  The first one is the one you set to the BusinessObject property, and the other 10 are dynamically created and set to a specific CurrentRowIndex so that the accessor of the BBS gets a different item reference for each object in the "list."

So, yes, the constructor will be fired 11 times, once for each of the 11 business objects.  Also, CurrentDataTableRefilled is fired during or immediately after the constructor, so it will also be fired 11 times.  If you want logic to fire within the CurrentDataTableRefilled event, but you only want to have it fire on the first business object, then you'll need to manually attach the handler to the event and call it on the first object instance.  That way, it won't be attached to the other 10 that are created for the list.

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