Using NOLOCK with LinqPad

511 views Asked by At

I'm using linqPad 5 and I wanted to make my query with NOLOCK I know it can be done normally with linq to sql using:

new TransactionScope(
                TransactionScopeOption.Required,
                new TransactionOptions
                {
                    IsolationLevel = IsolationLevel.ReadUncommitted
                });

but I'm not sure if just adding this to the .linq file will work, or how to check it works. It's a simple read only query as can be seen below

Anyone can help with this? Thanks!

void Main(string[] argv)
{
        var test = select * from tableA;
        test.Dump();
        scope.Complete();
    }
}
private TransactionScope CreateReadUncommittedScope()
{
    return new TransactionScope(
        TransactionScopeOption.Required,
        new TransactionOptions
        {
            IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
        });
}
0

There are 0 answers