我可以在 TransactionScope 中做任何其他事情(与数据库无关)吗?
这会是一个坏习惯吗?
例如
在范围内启动工作流。
除非启动工作流失败,否则我不想保存在数据库中。
如果这是一个不好的做法,那么什么是好的做法?
提前致谢。
using (TransactionScope scope = new TransactionScope())
{
using (ComponentCM.Audit auditComponent = new ComponentCM.Audit())
{
using (AccessCM.Biz dataAccess = new AccessCM.Biz())
{
auditComponent.SaveInDB();
dataAccess.SaveinDB()
StartWorkflow();
}
}
scope.Complete();
}