We are making multiple updates to our Entity Framework object context based on the changes made to the UI. For e.g.
If we have an Employee entity in our context we are coding in the following manner
using (TestDBEntities testDBContext = new TestDBEntities())
// Code to add a new employee
// Code to update an existing employee
// Code to delete an employee
// Save changes to the database
In this scenario we want to trap all the possible exceptions that can result in during the various add, update, delete operations. Presently we have observed that SaveChanges() throws only one exception at a time like OptimisticConcurreny exception / UpdateException and aborts the transaction. Is there any in-built mechanism in EF where in we can get all possible exceptions generated during SaveChanges so that all errors can be displayed to the user at the same time and then abort the transaction?