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

NOLOCK #11897

Closed
turenc opened this issue May 3, 2018 · 4 comments
Closed

NOLOCK #11897

turenc opened this issue May 3, 2018 · 4 comments

Comments

@turenc
Copy link

turenc commented May 3, 2018

Hi,

Is it possible to add an extension method for linq queries that table-base sql "with nolock" mssql statement?
Sample: "SELECT * FROM CUSTOMERS WITH(NOLOCK)"

I don't want change db transaction isolation level this case. Because I don't begin a database transaction for select queries and I want generate a sql query with "with nolock" mssql statement.

Regards,
Türenç.

@ralmsdeveloper
Copy link
Contributor

FromSql would not help you for now?

Possibly covered by: #6089

@ajcvickers
Copy link
Member

Duplicate of #6717

@ajcvickers ajcvickers marked this as a duplicate of #6717 May 4, 2018
@turenc
Copy link
Author

turenc commented May 6, 2018

If I can't use the linq query for a basic "select" query, there is no point in using complex orm like Entity Framework. A micro orm like dapper or petapoco, would be a better and lightweight choice.

@Emrahdi
Copy link

Emrahdi commented May 11, 2018

Hi,
We have a big database and stored procedures. Most of the procedures contain "nolock" statements and we plan to remove these store procedures.
Using FromSql solution forces us to generate all our queries manually and this can lead us not to use Entity Framework.
I think there should be an option in linq queries as follows:

context.Books
.Select(b => new {
BookId = b.BookId,
Title = b.Title
}).Nolock().ToList();

ralmsdeveloper added a commit to ralmsdeveloper/EntityFrameworkCore that referenced this issue Jun 6, 2018
* This PR would be a Start for future implementations and improvements in SQL Hints.
* Resolve dotnet#11897
* Thought of: dotnet#6717
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants