Linked Questions
19 questions linked to/from Entity Framework with NOLOCK
63 votes
7 answers
123k views
Get Entity Framework 6 use NOLOCK in its underneath SELECT statements [duplicate]
I am using Entity Framework 6 in an MVC 5 project. As you're aware of, SELECT queries in SQL Server perform faster and more efficient if we use WITH (NOLOCK) in them. I checked out a few SQL SELECT ...
13 votes
1 answer
17k views
How to force Entity Framework not to lock the database [duplicate]
Possible Duplicate: Entity Framework with NOLOCK I'm using EF4 and .Net 4 to load some XML from a file into a database. I have a class the wraps around the ObjectContext and has methods that add ...
39 votes
5 answers
18k views
using ThreadStatic variables with async/await
With the new async/await keywords in C#, there are now impacts to the way (and when) you use ThreadStatic data, because the callback delegate is executed on a different thread to one the async ...
20 votes
4 answers
16k views
NOLOCK vs. Transaction Isolation Level
What's the difference between using "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" and NOLOCK? Is one better than the other?
4 votes
3 answers
14k views
entity framework and dirty reads
I have Entity Framework (.NET 4.0) going against SQL Server 2008. The database is (theoretically) getting updated during business hours -- delete, then insert, all through a transaction. Practically, ...
7 votes
1 answer
8k views
Entity Framework Dead Lock Victim on Read Only Statements
I have an OData service (WCF Data Service using Entity Framework). All this service does is select data. (No writes EVER.) When I run my OData queries, I am occasionally getting errors like this: ...
4 votes
2 answers
8k views
EF Core 2.0 TransactionScope Error
I am trying to use TransactionScope in my SELECT query in EntityFramework Core 2.0. However I am getting this error : "Enlisting in Ambient transactions is not supported." The idea is to implement "...
7 votes
3 answers
5k views
How do I control parameter sniffing and/or query hints in entity framework?
I have a problem where one of my Entity Framework (EF) queries is taking a very long time to execute in Sql Server, although when I copy-and-paste the generated TSQL into Sql Server Management Studio (...
3 votes
3 answers
3k views
Why does Entity Framework ignore TransactionScope (not adding with NOLOCK)?
What am I missing? I'm trying to read with NOLOCK using a TransactionScope like this: var scopeOptions = new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted }; using (var scope =...
6 votes
2 answers
4k views
Can entity framework select block the table?
I heard that SQL Server SELECT statements causing blocking. So I have MVC application with EF and SQL Server 2008 and it shares DB with another application which is very frequently writes some data. ...
4 votes
0 answers
14k views
Transaction was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction
ASP.NET MVC project 4.5 and EntityFramework Database First. I have some command, which will be triggered when the user clicks a button using (TransactionScope scope = new TransactionScope()) { ...
0 votes
1 answer
9k views
Entity Framework ExecuteStoreCommands Exception during FirstOrDefault method
Occasionally, while debugging some older application code, we receive an exception. This is the offending line of code: XMLReferenceSequence lastXml = (from xml in _entities.XMLReferenceSequences ...
2 votes
2 answers
1k views
Refresh data from stored procedure
I have a c# entity framework application. I am trying to run a stored procedure from code (no problem with that). its long running, around 30 mins. I write a log of each transaction to a SQL table as ...
3 votes
2 answers
1k views
What happens if I don't Complete() my TransactionScope when doing a query?
I'm working with a system using Entity Framework, and I'm wrapping a call in a TransactionScope but only because I want to set the IsolationLevel as ReadUncommited (basically doing NOLOCK, as ...
1 vote
1 answer
2k views
Entity Framework read queries locking all database
I'm developing a web application using ASP.NET MVC and EF6 to access the database. One of the features of my web application allow the user to download a Excel file. The query to get the information ...