Sachin Kainth
Sachin Kainth

Reputation: 46750

Ensuring Atomicity with Entity Framework

I am writing inserts and updates into a database using Entity Framework. The issue is that I want to do what I used to do with stored procedures, which is make groups of updates and inserts atomic by putting transactions around them. How is this sort of thing possible with linq to Entities/Entity Framework?

Thanks,

Sachin

Upvotes: 0

Views: 132

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364279

When you call SaveChanges it automatically executes everything in single transaction. If you need to group changes into separate transaction you must do them in sequence and call SaveChanges for each group separately.

Upvotes: 1

Related Questions