Unit of Work

Posts   
 
    
kenb_mdc
User
Posts: 2
Joined: 04-Jan-2006
# Posted on: 04-Jan-2006 20:39:06   

I'll try to explain my situation as best I can.

I have an entity Entity1

Entity1 is added to the unit of work recursively

I have a collection off Entity1 and in this collection I have two new entities CollectionEntity1 CollectionEntity2

I need to setup CollectionEntity1 and CollectionEntity2 in the following manner. CollectionEntity1.SpouseEntity = CollectionEntity2 CollectionEntity2.SpouseEntity = CollectionEntity1

I set this all up and everything seems to be ok and I add CollectionEntity1 and CollectionEntity2 to the collection.

However, when the unit of work is committed, if I add CollectionEntity1 to the collection first then it's spouseID is not set and CollectionEntity2's spouseID is set and all is well. If I add CollectionEntity2 to the collection first then it's spouseID is not set and CollectionEntity1's spouseID is set and all is well.

Why aren't both spouseIDs being set in the collection?

Does this have something to do with the way the unit of work recursively inserts and updates entities.

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Jan-2006 06:19:55   

Please provide a code snippet of what you are trying to do. It would help us to better understand your question. Thanks

kenb_mdc
User
Posts: 2
Joined: 04-Jan-2006
# Posted on: 05-Jan-2006 19:12:11   

Thanks for taking the time to look at this thread. I found a work around.

Thanks. smile