Entity Framework: Is the completely transaction complete after SaveData?
user4391 Published in September 21, 2018, 8:44 am
Working on MVC5, EntityFramework6 web application. Usually in my classes I define my context var in the class scope...
public class MyResultsController : Controller
private readonly XYZ_MyContext db = new XYZ_MyContext();
Then I just reference 'db' whenever I want to access the context.
In my methods that save data I do it like this...
I typically dont use a Using statement.
My questions are....
(1) At the point you call SaveChanges, if it doesn't error out, then the transaction is complete right? You dont have to explicitly end it? (The data isn't cached temporarily, etc...)
(2) Also, if I see the actual data in the database is the transaction 100% complete for sure? In other words, if I can see the data in the data table (via SSMS), the data won't just "disappear" unless it's explicitly deleted, right?