简体   繁体   English

如何处理dotnet世界中的交易?

[英]How to handle transactions in dotnet world?

we are using linq-to-sql in a desktop project? 我们在桌面项目中使用linq-to-sql? How should we handle transactions? 我们应该如何处理交易? What about using transaction scope? 那么使用事务范围呢?

Linq-to-sql supports three transaction models described here . Linq-to-sql支持此处描述的三种事务模型。

You can use TransactionScope to bracket several actions. 您可以使用TransactionScope来包含多个操作。

I am in the process of creating a business logic and data access logic layer for our application framework. 我正在为我们的应用程序框架创建业务逻辑和数据访问逻辑层。 We are using Linq-to-SQL. 我们正在使用Linq-to-SQL。 For simple transactions, we use the default L2S transaction support that the SubmitChanges() method call uses. 对于简单事务,我们使用SubmitChanges()方法调用使用的默认L2S事务支持。 For more complex transactions, we use Transaction Scope. 对于更复杂的事务,我们使用Transaction Scope。 Transaction scope works very well, and won't escalate to an MTC transaction if the transaction is limited to a single database and single connection. 事务范围非常有效,如果事务仅限于单个数据库和单个连接,则不会升级到MTC事务。

Randy 兰迪

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM