有没有办法将 System.Transactions 与连接池一起使用?
我认为 Framework 2.0 中的 System.Transaction 类是一个很棒的工具,设计精良,旨在简化处理事务时的代码。
但是,(但是),如果不升级为分布式事务,就不可能使用与同一数据库有多个连接(相同的连接字符串)的那些类。
Microsoft 正在努力解决此问题,但与此同时,任何人知道一个可靠、简单的解决方法来允许连接池机制,同时保持使用 System.Transactions 的能力吗?是否可以?
I think the System.Transaction classes in Framework 2.0 are a great tool, well designed, aimed to simplify code when working with transactions.
But, (big but), it's impossible to use those classes with multiple connections to the same database (same connection string) without promoting to distributed transactions.
Multiple Connections With Same Connection String Under A Single Transaction, Elevated Transaction?
Microsoft is working to solve this, but meanwhile ¿anyone knows a reliable, simple workaround to allow connection pooling mechanism while keeping the ability to use System.Transactions? Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您想要实现什么:
编辑:
我同意下面的评论,最好根据需要打开和关闭连接。但是,如果连接是事务的一部分,它将不会返回到池中,在这种情况下,您可以尝试重用它。
Not sure what you are trying to achieve:
EDIT:
I agree with the comments below that it is best to open and close connections as required. But if a connection is part of a transaction it will not be returned to the pool, in that case you could try to reuse it.