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?
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
3 Answer(s)
-
0
Please share your code.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
User user = null; using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted})) { { user = await UserManager.GetUserByIdAsync(input.UserId); } }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
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(); } }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)