The case is as follows:
- Deleting and inserting rows in an assignment table, for example PersonInAERole.
- The membership set content changes and I want to delete the existing items and insert the new members afterwards.
For example we start with the initial set {A, B, C} and the new membership set will be {A, C}. When deleting an entity (interface IEntity) with for example the method MarkForDeletionWithoutDelay the process is as follows:
- The XOrigin column on the record is updated to the value zero (0).
- A process is raised that deletes the row using SQL. The session variable XORIGINEMPTY is set for the process.
This pretty much means that you can't delete the initial set and insert the new set in a tight loop because the removal of the records in the database are dependent on the removal process being executed. What is the recommended programming idiom for this use case? I normally use the LINQ extension methods Except etc. to find the differences between the sets and delete what is not needed, but I am a consultant and not a programmer and would like to know if there are simpler methods.
Thx,
Rodney