Is it possible to get Linq2Sql to emit a NOLOCK in its SQL? And if so, how?
Here is an extension method to use with LINQPAD
public static IQueryable Dump2(this IQueryable query)
{
using (var txn = new System.Transactions.TransactionScope(TransactionScopeOption.RequiresNew,
new TransactionOptions
{
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
}))
{
return query.Dump();
}
}
Then you can call it as:
MyTable.Where(t => t.Title = "Blah").Dump2();