在客户端 ADO.NET 应用程序中是否应该避免快照事务隔离?那么它的主要目的是什么?

发布于 2024-09-30 14:50:56 字数 1184 浏览 5 评论 0原文

读过 [1]:

  • “持久数据库连接要求限制了 SNAPSHOT 隔离可扩展性,因此不应将其用作实现乐观并发的通用方法”

我想了解:
ADO.NET 中什么是持久连接?<​​br> 我根本不记得,在编写 .NET 应用程序时,我配置了 SQL Server 连接的任何持久性。
它在哪里?

“持久连接”是断开模式的反义词吗?

在编写 ADO.NET 客户端应用程序(例如,C#)时需要持久连接意味着什么?
如何在 ADO.NET 客户端应用程序中使用快照事务隔离?
其(快照事务隔离级别)主要目标领域是什么?

另外,我有些困惑,因为读到大多数 .NET 框架和功能(例如 Linq2SQL)不支持悲观锁定(好吧,提示)...但分布式事务不支持快照隔离 [2]

应该SQL Server 内置乐观并发功能是否可以避免并由自定义乐观(版本控制)事务支持替代?
再说一遍,它们的用途和原因是什么?为什么要在这样的(对我来说很难理解)实现中引入它们?

[1] 丹·古兹曼的博客。
并发模型困惑二
http://weblogs.sqlteam。 com/dang/archive/2008/06/07/Concurrency-Model-Confusion-II.aspx
[2]
为什么 SQL Server 中的分布式事务不支持快照隔离
为什么分布式事务不支持快照隔离在 SQL Server 中
[3]
何时更喜欢悲观的事务隔离模型而不是乐观的模型?
何时更喜欢悲观事务隔离模型而不是乐观模型一个?

Having read in [1]:

  • "The persistent database connection requirement limits SNAPSHOT isolation scalability so it shouldn’t be used as a general means of implementing optimistic concurrency"

I'd like to understand:
What is persistent connection in ADO.NET?
I simply do not remember that, while programming .NET apps, I configured any persistence of SQL Server connections.
Where was it?

Is "persistent connection" antonym of disconnected mode?

What are implications of the need to have persistent connection in coding ADO.NET client apps (in, for ex., C#)?
How snapshot transaction isolation is to be used in ADO.NET client apps?
What is its (snapshot transaction isolation levels) main target area of engagement?

Also, I am somewhat confused, having read that most .NET frameworks and features, like, for ex., Linq2SQL, do not support pessimistic locking (well, hints)... but distributed transactions do not support snapshot isolation [2]

Should SQL Server built-in optimistic concurrency functionalities be avoided and substituted by custom optimistic (versioning) transaction support?
Again, what's for and why were they introduced in such (difficult to understand for me) implementation?

[1] Dan Guzman's Blog.
Concurrency Model Confusion II
http://weblogs.sqlteam.com/dang/archive/2008/06/07/Concurrency-Model-Confusion-II.aspx
[2]
Why isn't Snapshot isolation supported with Distributed Transactions in SQL Server
Why isn't Snapshot isolation supported with Distributed Transactions in SQL Server
[3]
when to prefer pessimistic model of transaction isolation over optimistic one?
when to prefer pessimistic model of transaction isolation over optimistic one?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

末が日狂欢 2024-10-07 14:50:56

虽然文档对我来说不太清楚,但我是这样解释的。如果我有一个独占使用的连接,我可以使用快照隔离来实现乐观并发,正如我在这篇文章中所描述的: 开发在并发中生存的修改。如果存在冲突,您将收到一条错误消息:“快照隔离事务因更新冲突而中止。”

然而,要利用这种方法,我们必须保持连接打开,并且不能使用连接池。请注意,在某些环境中,空闲连接会在空闲一段时间后自动终止。

Although the documentation is not quite clear to me, here is how I interpret it. If I have a connection in my exclusive use, I can use snapshot isolation to implement optimistic concurrency, as I described in this article: Developing Modifications that Survive Concurrency. If there is a conflict, you will get an error message: "Snapshot isolation transaction aborted due to update conflict."

However, to utilize this approach, we must keep the connection open, and we cannot use connection pooling. Note that in some environments idle connections are automatically killed after some idle period.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文