I'm working with a system using Entity Framework, and I'm wrapping a call in a TransactionScope but only because I want to set the IsolationLevel as ReadUncommited (basically doing NOLOCK, as described in one of the answers here). This is only a query, no changes to any data.
using (var scope = new TransactionScope(TransactionScopeOption.Required,
new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
{
List<T> toReturn = query.ToList();
scope.Complete();
return toReturn;
}
My understanding is that calling Complete() is like doing a SQL commit. What happens if I don't call scope.Complete()? This is just a database query so there's nothing to commit.