在 EF4 中使用 NOLOCK 提示?

我们正在评估 EF4,我的 DBA 说我们必须在所有 SELECT 语句中使用 NOLOCK 提示.所以我正在研究如何在使用 EF4 时实现这一点.

We're evaluating EF4 and my DBA says we must use the NOLOCK hint in all our SELECT statements. So I'm looking into how to make this happen when using EF4.

我已经阅读了有关如何在 EF4 中实现这一点的不同想法,但所有这些想法似乎都是一种解决方法,并且并未受到 Microsoft 或 EF4 的批准.如果有人希望他们的 SELECT 语句在使用 LINQ-to-SQL/LINQ-to-Entities 和 EF4 时包含 NOLOCK 提示,微软官方"的回应是什么?

I've read the different ideas on how to make this happen in EF4, but all seem like a work around and not sanctioned by Microsoft or EF4. What is the "official Microsoft" response to someone who wants their SELECT statement(s) to include the NOLOCK hint when using LINQ-to-SQL / LINQ-to-Entities and EF4?

顺便说一句,我发现的绝对最好的信息是 就在此处,我鼓励对此主题感兴趣的每个人都阅读此主题.

By the way, the absolute best information I have found was right here and I encourage everyone interested in this topic to read this thread.

谢谢.

推荐答案

NOLOCK = "READ UNCOMMITTED" = 脏读

NOLOCK = "READ UNCOMMITTED" = dirty reads

我假设 MS 知道他们为什么选择默认隔离级别为READ COMMITTED"

I'd assume MS knows why they chose the default isolation level as "READ COMMITTED"

NOLOCK,实际上是任何提示,都应该非常明智地使用:默认情况下不是.

NOLOCK, in fact any hint, should be used very judiciously: not by default.

你的 DBA 是个木偶.看到这个(SO):在 SQL Sever 中的每个 SELECT 上使用 (nolock) 会发生什么?.如果您碰巧在银行或我可能拥有帐户的任何机构工作,请告诉我,以便我可以关闭它.

Your DBA is a muppet. See this (SO): What can happen as a result of using (nolock) on every SELECT in SQL Sever?. If you happen to work at a bank, or any institution where I may have an account please let me know so I can close it.

相关文章