cancel
Showing results for 
Search instead for 
Did you mean: 

Entity Framework 4.2 and Ambient Transactions - Cannot enlist in a transaction with uncommitted data

Former Member
0 Kudos
3,540

I am using SqlAnywhere 11.0.1.28374 with Code First Entity Framework 4.2. I'm having a problem with the following code:

System.Transactions.CommittableTransaction tx = new CommittableTransaction();
Transaction.Current = tx;
MyDbContext context = new MyDbContext(connStr); //Constructor builds SAConnection from connStr
ObjectContext oc = ((IObjectContextAdapter)context).ObjectContext;
oc.Connection.Open();

The last line produces the error, "Cannot enlist in a transaction with uncommitted data." But as you can see, there have been no data changes on the connection yet. Is this a bug? Is there some other way to enlist in an ambient transaction? (btw, TransactionScope behaves the same way)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Turned out to be a problem in a login_procedure. I added a commit at the end of the login_procedure, and now everything works beautifully.

Answers (0)