When context contains related entitties and SaveChanges
is called EF issues queries in right sequence not breaking referential constrainst.
Unfortuantely, EF does not support alternative keys, hence it cannot deduce the correct order of commands, so we need to define the order ourselves if this is possible.
I think the order of operation is totally under entity framework control - essentially meaning you cannot influence the order of operation.
I think the only way to manage this is to make the changes in order saving changes at each point you want it to commit - i.e. force EF to make the changes in order.
Similar question: https://stackoverflow.com/a/7335895/626354
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With