在我的項目中,DAL是WCF服務.Net4.0。使用數據庫oracle 11g。我在WCF(服務器端)使用事務範圍。 如果任何一個sp失敗,我必須調用方法(操作契約)中的多個存儲過程,我需要回滾已執行的sp。但是回滾沒有發生。我沒有使用客戶端事務流。WCF內的事務範圍中的問題
我把示例代碼
公共類服務:IService {
public bool Method1()
{
using (TransactionScope Scope1 = new TransactionScope())
{
Method2();
Method3();
Scope1.Complete();
}
return true;
}
public bool Method2()
{
using (TransactionScope Scope2 = new TransactionScope())
{
// Procedure call .....
Scope2.Complete();
}
return true;
}
public bool Method3()
{
using (TransactionScope Scope3 = new TransactionScope())
{
// Procedure call .....
Scope3.Complete();
}
return true;
}
}
你可以發佈你的代碼嗎 – 2011-06-17 13:39:15