我得到了一个看起来像这样的服务组件(不是我写的):
[Transaction(TransactionOption.Required, Isolation = TransactionIsolationLevel.Serializable, Timeout = 120), EventTrackingEnabled(true)]
public class SomeComponent : ServicedComponent
{
public void DoSomething()
{
try
{
//some db operation
}
catch (Exception err)
{
ContextUtil.SetAbort();
throw;
}
}
真的ContextUtil.SetAbort()
需要吗?当组件离开时,异常不会中止事务吗?