MyCollection of Entities

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 19-Nov-2004 22:04:18   

Hi All, I want to write a simple strongly typed collection for entity objects generated by LLBL (Adapter). I had no problems inheriting from CollectionBase and building my strongly typed collection and all is OK. Now I want my collection to implement IBindingList. I know that entity objects generated by LLBL implement IEditableObject but I want some sort of notification from the entity object when its doing its CancelEdit work. More accuretly, I want the entity object to give a notification when a NEW object is doing a CancelEdit (so that the ESC thing would work with grids) Is there a way to establish such a comunication between my collection and LLBL's entity objects?

OMAR

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 21-Nov-2004 12:15:33   

omar wrote:

Hi All, I want to write a simple strongly typed collection for entity objects generated by LLBL (Adapter). I had no problems inheriting from CollectionBase and building my strongly typed collection and all is OK. Now I want my collection to implement IBindingList. I know that entity objects generated by LLBL implement IEditableObject but I want some sort of notification from the entity object when its doing its CancelEdit work. More accuretly, I want the entity object to give a notification when a NEW object is doing a CancelEdit (so that the ESC thing would work with grids)

Internally, EntityBase(2) has a flag if it's created from databinding and also it's parent collection.

EntityCollectionBase(2) both implement IBindingList. The AddNew() routine sets the flag and the parent collection of the entity added, using properties which are marked internal...

To overcome this, you could re-implement this (re-implement the properties and CancelEdit()) in a derived class for the entity. This is not ideal though. If you want a strongly typed collection, I'd derive the strongly typed collection from EntityCollection. simple_smile

Frans Bouma | Lead developer LLBLGen Pro