I'm learning EF Core and trying to change the isolation level of a transaction instance.
Here is the code I set up a transaction instance with ReadUncommitted level :
var transaction = new CommittableTransaction(new TransactionOptions
{ IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted });
I tried the below code to make it ReadCommitted, but doesn't work as IsolationLevel property is read-only.
context.Database.GetEnlistedTransaction().IsolationLevel = IsolationLevel.ReadCommitted;
How can I do it programmatically?
There's no API for that, either because not all platforms support changing the transaction isolation level in-flight, or because it's a very unusual thing to attempt.
For SQL Server you can do this (if you really want to) with TSQL, but normally you just select the transaction isolation level a the beginning of the transaction.