So you instantiate an EF context, push objects in or pull objects out, it tracks the complete state of the object changes (if change tracking on). Up until this point the devel
Handling SavingChanges
event is one way but for more complex handling you can override SaveChanges
operation itself in your derived context. The difference is that in SavingChanges
you can put custom logic before SaveChanges
do its job but when overriding SaveChanges
you can put custom logic before and after calling base.SaveChanges
. There is not better support for custom logic during saving. Using custom SQL for saving is only possible if you map stored procedures to data modification operations of your entities.