Otis wrote:
That's not possible. A delete which violates an FK is such a severe error that for example SQLServer aborts any transaction which is going on. So it will always fail on the first entity which isn't correctly ordered.
Let me try to understand, because this has significant design implications. For example, an AccountEntity has an associated EmployeeEntityCollection. Using UOW2, I select five employees to be deleted. Four of the employees DO NOT have associated timecard transactions posted against them and therefore, SQLServer allows them be deleted. The fifth employee HAS associated timecard transactions and SQLServer fails when attempting the delete (RI setting in SqlServer).
Now, if there was a way to handle each EmployeeEntity deletion individually, then we might allow the four employee records to be deleted and communicate back to the user the one employee that could not be deleted.
If there is no way to communicate individual entity exceptions back to the user, then the entire transaction would fail and the user wouldn't know which employee record caused the failure.
How do I design around that?
Thanks. Jeff