Need to use WITH (NOLOCK) with select queries
Hi
I'm using bltoolkit for my application and after deploying it on production environment it was very slow due to read with locking, I have no problem to read dirty data, so how to use WITH (NOLOCK) with my select queries
Thanks
See an example:
using (DbManager db = new DbManager())
{
db.BeginTransaction(IsolationLevel.ReadUnCommitted);
// ...
db.CommitTransaction();
}
I know that read uncommitted will work but I Use a generic method to get queryable from an entity and I don't know exactly when the query will be executed or else when I'm getting my result ( calling ToList() Method ) I must call commitTransaction after it
Any other solutions
Is it not possible to use IsolationLevel.ReadUnCommitted without creating a Transaction? Or is it no problem if I create a Transaction for every read call?
that is what I'm saying, I will need to open transaction with any read operation which is not possible with linq deferred execution
Any solution
@mfatah14, See this, it can work for you: https://github.com/igor-tkachev/bltoolkit/issues/214#issuecomment-19973814
Though initially I put a question there about query hints, the answers were still useful and allowed me to implement table hints, e.g. "with (nolock)".