I have a routine that has the potential to add entities to a UOW multiple times, which need to be saved to the database multiple times.
I have a table that has a "seed" column, and the column has a unique constraint on it. When a user changes a seed value, the logic cylces through the complete set of entities and fixxes the gaps in their order, starting at 1. However, because changes to the entities may conflict with existing records in the database, I first loop through the entities and set the seed to a negative number, then save and loop through again to make them positive (and save again).
What I'd like to do is ensure that both saves happen in the same transaction, and (best case) would be to use a UOW.
Is this possible, or am I barking up the wrong tree?
Hope that made sense.
Thanks,
Phil