I open a transaction scope with IsolationLevel = IsolationLevel.ReadUncommitted (I need to execute a non blocking query). Inside the transaction, I execute a query on an injected dbContext (.NET Core 3.1 with EF Core 3.1). I would expect the query to execute as a ReadUncomitted, but inspecting SQL Server Profiler, I see the following 2 relevant lines:
Inside the "login" line, is the following:
The line with "exec sp_exe....." has my query.
The relevant lines of code are:
using (var tx = this.Transactions.Required())
{
var query = await this.Uow.MyEntity.MyQuery(myParameter);
if (query != null)
{
...do something
}
await this.Transactions.CompleteAsync(tx);
}
and
public System.Transactions.TransactionScope Required()
{
var transactionOptions = new System.Transactions.TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted };
transactionOptions.Timeout = TimeSpan.FromHours(2);
return new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions, System.Transactions.TransactionScopeAsyncFlowOption.Enabled);
}
I am I missing something? All examples of using the TransactionScope show the dbContext created inside the TS, but in my case, dbContext is injected.
Any guidance will be greatly appreciated.

