System.InvalidOperationException: 'An ambient transaction has been detected. The ambient transaction needs to be completed before beginning a transaction on this connection.' code example
Example: An ambient transaction has been detected. The ambient transaction needs to be completed before beginning a transaction on this connection.
using (var ambientTxn = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
using (var txn = await context.Database.BeginTransactionAsync())
{
}