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.