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莽.
FromSql would not help you for now?
Possibly covered by: https://github.com/aspnet/EntityFrameworkCore/issues/6089
Duplicate of #6717
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.
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();
Most helpful comment
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();