Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to use WITH (NOLOCK) with select queries #328

Open
mfatah14 opened this issue Sep 17, 2014 · 6 comments
Open

Need to use WITH (NOLOCK) with select queries #328

mfatah14 opened this issue Sep 17, 2014 · 6 comments

Comments

@mfatah14
Copy link

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

@MaratFattakhov
Copy link
Contributor

See an example:

        using (DbManager db = new DbManager())
        {
            db.BeginTransaction(IsolationLevel.ReadUnCommitted);

            // ...

            db.CommitTransaction();
        }

@mfatah14
Copy link
Author

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

@jogibear9988
Copy link

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?

@mfatah14
Copy link
Author

that is what I'm saying, I will need to open transaction with any read operation which is not possible with linq deferred execution

@mfatah14
Copy link
Author

Any solution

@kam99
Copy link

kam99 commented Oct 10, 2014

@mfatah14,
See this, it can work for you: #214 (comment)

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)".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants