Sue
Sue

Reputation: 81

Entity Framework without Transaction?

Is there a way to use EF without transaction? I have very simple single insert and don't want to roll-back when something goes wrong as there may be a trigger logging then raising error from the DB side which I have no control over. I just want to insert then catch any exceptions but don't want to roll-back.

Upvotes: 8

Views: 1513

Answers (2)

John Farrell
John Farrell

Reputation: 24754

using( var transation = new TransactionScope(TransactionScopeOption.Suppress) )
{
    ObjectContext.SaveChanges();
}

Upvotes: 2

Devart
Devart

Reputation: 121922

We are not aware of any way to get rid of transactions in Entity Framework CUD operations.

Upvotes: 3

Related Questions