【发布时间】:2013-04-20 07:30:53
【问题描述】:
假设我必须使用不同的方法并将它们放在transaction scope 中。
但是每种方法都会打开它的连接。所以我需要在 Windows 服务器中启用MSDTC service。
但它是一个共享托管服务器,我无法启用它。
class Debit
{
public void InsertA()
{
//InsertCode
}
}
class Credit
{
public void InsertB()
{
// InsertCode
}
}
using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
{
DebitBAL debit = new DebitBAL();
CreditBAL credit = new CreditBAL();
debit.InsertA();
credit.InsertB();
ts.complete();
}
我使用entity framework 进行我的陈述。
在共享主机服务器中使用transaction scope 是个好主意吗?
【问题讨论】:
-
相关:social.technet.microsoft.com/wiki/contents/articles/… 您应该考虑更改代码,以便不需要分布式事务,这与使用
TransactionScope并不相互排斥。
标签: asp.net entity-framework transactionscope