Adding on the client side,

Posts   
 
    
craigmain
User
Posts: 22
Joined: 17-Apr-2005
# Posted on: 12-May-2005 18:49:17   

Hi,

If I have an entitycollection a, which contains a one to many relationship to enity type b. I also have a collection of entity b objects on the client side.

Collection of (a) is ca Collection of (b) is cb.

Is there an easy (generic) way to code inserting element (b) instances from their collection cb into the various collections (a.cb) in each of the entity a instances.

I had a brief look at the relationship object and was planning to use.

MergeCollection(EntityCollection a, IEntityRelation relation, EntityCollection b) I would then have iterated all the b elements, finding their corresponding entity in a, and adding them to the correct field (collection) in a.

The tricky part is dereferencing or finding that collection in a, the rest can be done reasonably generically.

I have a collection of these things on the client that need to be added correctly to their collections.

Any pointing in the right direction would be appreciated.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 13-May-2005 11:36:58   

Just set each b.a reference to the a they belong to and b is added to a.cb automatically.

Frans Bouma | Lead developer LLBLGen Pro