0
mgarcia created
Im trying to make an scope for some Read uncommitted values I need. But I get this error "An ambient transaction has been detected. The ambient transaction needs to be completed before beginning a transaction on this connection." How can I apply some dirty read in web api core 2 project?
3 Answer(s)
-
0
Please share your code.
-
0
User user = null; using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted})) { { user = await UserManager.GetUserByIdAsync(input.UserId); } }
-
0
Hi @mgarcia, can you try to call
Complete()
in the last line of your scopeUser user = null; using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted})) { { user = await UserManager.GetUserByIdAsync(input.UserId); t.Complete(); } }