public void DeleteRecursion()
{
using (TransactionScope ts = new TransactionScope())
{
try
{
DeleteInternal(); ts.VoteCommit(); }
catch (Exception pEx)
{
ts.VoteCommit();//回滚事务
LogManager.getInstance().getLogger(this.GetType()).Error(pEx);
throw new AppException("结点递归删除失败"); }
}
} private void DeleteInternal()
{
if (!this.Loaded)
throw new AppException("尚未出始化");
List<MenuInfo> list = this.MenuItems;
foreach (MenuInfo mi in list)
{
mi.DeleteInternal();
}
this.Delete();
}
{
ts.VoteRollback();//回滚事务
LogManager.getInstance().getLogger(this.GetType()).Error(pEx);
throw new AppException("结点递归删除失败"); }[/code]
try
{
TransactionBegin
...
TransactionCommit
}
except
{
TransactionRollBack
}