Home Entity Framework: Is the completely transaction complete after SaveData?
Reply: 0

Entity Framework: Is the completely transaction complete after SaveData?

user4391
1#
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...

[Authorize]
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...

this.db.SaveChanges();

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?

Thanks!

share|improve this question

1 Answer 1

active oldest votes
up vote 0 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304663 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO