0
public void Operation01()
{
//Some Data manipulation here.
this.UnitOfWork.Commit();
}
public void Operation02()
{
Operation01();
//Some db work here
//Some ERROR Occurs here, but operation 1 is commited.
this.UnitOfWork.Commit();
}
UnitOfWork是由框架使用IOC注入的類的私有成員。UnitOfWork模式的嵌套事務問題
我無法從Operation01中刪除Commit(),因爲它在應用程序中被稱爲獨立操作。 如果在Operation02()上發生任何錯誤,我想回滾所有更改。
任何其他方式,更優雅... –
魔法?這很簡單,你可以得到。 – dbugger