Frans,
I'm stuck on something which I thought I would ask you about:
I have a entity which has a circular reference with another entity (they both have foreign key fields which point to each other). This circular reference is required for performance reasons and cannot be eliminated...
The problem is when I try to create the entity graph to save under a UnitOfWork2... Obviously the trick is to use a combination of Weak Relations and a double save in order to get all the Identity columns to sync up... BUT... UnitOfWork2 doesn't allow you to add an entity to the save collection twice...
So I tried to sub class it... but and that's not going to work either as I even if I override AddForSave I can't get access to the private _entitiesToSave collection...
The other issue is that this all has to happen within a complex framework where the Adapter / UnitOfWork is created and passed in from an upper layer.
The only thing I can come up with is to start a transaction on the adapter and manually save the entity to the db with a refetch (outside of the UnitOfWork). I can then add the problem related entities and add it to the UnitOfWork for a second save. I must keep the transaction open for the remainder of the processing until the upper layer calls commit on the UnitOfWork which will save the entity again. Since UnitOfWork commit uses the same adapter on which the transaction was started earlier.. a failure should rollback both saves...
In theory...
What do you thing?
Marcus