I'm having a discussion with a friend about how to check if the context was saved successfully in Entity Framework.
His opinion is that we should check the integer returned by SaveChanges()
and compare it to what we expected
Example: Check expected with returned
Mine is that we can assume that SaveChanges()
did it's job and everything was saved to the database if no exceptions are thrown.
Example: Catch exception
I found two similar question here, but they don't explain much.
one
two
So which method is better, and why?