【问题标题】:Data Access Application Block 4.1 and Transactions数据访问应用程序块 4.1 和事务
【发布时间】:2011-09-11 00:37:51
【问题描述】:

谁能告诉我在使用 Enterprise Library 的 DAAB(​​4.1 版)时管理事务的首选方式是什么?我在想

Database NewDb = DatabaseFactory.CreateDatabase();
DBCommand NewCmd = NewDb.GetStoredProcCommand("SProcName");

/* Add parameters here. */

using (TransactionScope NewTrans = new TransactionScope())
{
    NewDb.ExecuteNonQuery(NewCmd);
    NewTrans.Complete()
}

但我不知道我是否会这样做。

【问题讨论】:

    标签: transactions enterprise-library daab


    【解决方案1】:

    TransactionScope 是在 Enterprise Library 中进行事务性工作的首选方式。你的例子很好。

    您确实可以选择进行手动事务管理 - 这主要是为了向后兼容旧 Entlib 代码。

    【讨论】:

      猜你喜欢
      • 2017-11-15
      • 2011-07-28
      • 2011-04-21
      • 1970-01-01
      • 1970-01-01
      • 2018-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多