Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to explicitly set the order of operations for SaveChanges? [duplicate]

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.

like image 475
Pavel Voronin Avatar asked Oct 10 '13 07:10

Pavel Voronin


1 Answers

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

like image 148
Matt Whetton Avatar answered Sep 30 '22 20:09

Matt Whetton