thanks for the question, I will file a product enhancement request for that. At the moment, we have only a dirty trick that I would not recommend if it wasn't to just get you around the issue:
> AlterConnection = (con, msg) =>
(var cmd = con.CreateCommand())
cmd.CommandText = msg;
(var con = Context.Connection)
"SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED"
// your special query here
var query = from p
Context.Products where p.SupplierID == 2 select p;
var result = query.ToList();
// an absolute must!
"SET TRANSACTION ISOLATION LEVEL READ COMMITTED"
The trick here is to pin the connection on the context, set the isolation level via ADO API, run the query with the altered isolation level and reset the isolation level to the previous value.
It is a must to reset the isolation level in any case, otherwise nothing can be guaranteed afterwards as we are not resetting the isolation level. It would be best to reset it to the previous value, which I have not done there. Also, the connection must be returned.
In general, I would refrain from using such techniques, but sometimes they make sense.... We will think about how we can incorporate a NOLOCK on the LINQ level in a future version.
All the best,
the Telerik team
Sharpen your .NET Ninja skills
! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>