I have been using the following extension method.
You need to add it to the My Extensions file, which you can see in the My Queries tab.
public static class MyExtensions
{
public static IQueryable<T> DumpNoLock<T>(this IQueryable<T> query)
{
using (new System.Transactions.TransactionScope(TransactionScopeOption.RequiresNew,
new TransactionOptions
{
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
}))
{
return query.Dump();
}
}
}
So now you can dump your query using the following syntax:
Table1.Where(t1 => t1.Enabled).DumpNoLock()
Which is equivalent to including the NOLOCK option on your sql query.
I have been using the following extension method.
You need to add it to the My Extensions file, which you can see in the My Queries tab.
public static class MyExtensions
{
public static IQueryable<T> DumpNoLock<T>(this IQueryable<T> query)
{
using (new System.Transactions.TransactionScope(TransactionScopeOption.RequiresNew,
new TransactionOptions
{
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
}))
{
return query.Dump();
}
}
}
So now you can dump your query using the following syntax:
Table1.Where(t1 => t1.Enabled).DumpNoLock()
Which is equivalent to including the NOLOCK option on your sql query.