本文整理汇总了C#中ActivityExecutionContext.FaultActivity方法的典型用法代码示例。如果您正苦于以下问题:C# ActivityExecutionContext.FaultActivity方法的具体用法?C# ActivityExecutionContext.FaultActivity怎么用?C# ActivityExecutionContext.FaultActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActivityExecutionContext
的用法示例。
在下文中一共展示了ActivityExecutionContext.FaultActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExceptionOccured
internal void ExceptionOccured(Exception exp, Activity currentActivity, string originalActivityId)
{
if (this.ThrownException != exp)
{
this.ThrownException = exp;
this.activityThrowingException = currentActivity.QualifiedName;
originalActivityId = currentActivity.QualifiedName;
}
else
{
originalActivityId = this.activityThrowingException;
}
Guid contextGuid = ((ActivityExecutionContextInfo) ContextActivityUtils.ContextActivity(currentActivity).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
Guid empty = Guid.Empty;
if (currentActivity.Parent != null)
{
empty = ((ActivityExecutionContextInfo) ContextActivityUtils.ContextActivity(currentActivity.Parent).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
}
this.FireExceptionOccured(exp, currentActivity.QualifiedName, originalActivityId, contextGuid, empty);
using (new ServiceEnvironment(currentActivity))
{
using (this.SetCurrentActivity(currentActivity))
{
using (ActivityExecutionContext context = new ActivityExecutionContext(currentActivity, true))
{
context.FaultActivity(exp);
}
}
}
this.RollbackTransaction(exp, currentActivity);
if ((currentActivity is TransactionScopeActivity) || (exp is PersistenceException))
{
this.BatchCollection.RollbackBatch(currentActivity);
}
}
示例2: ExceptionOccured
internal void ExceptionOccured(Exception exp, Activity currentActivity, string originalActivityId)
{
Debug.Assert(exp != null, "null exp");
Debug.Assert(currentActivity != null, "null currentActivity");
// exception tracking work
//
if (this.ThrownException != exp)
{
// first time exception
this.ThrownException = exp;
this.activityThrowingException = currentActivity.QualifiedName;
originalActivityId = currentActivity.QualifiedName;
}
else
{
// rethrown exception
originalActivityId = this.activityThrowingException;
}
Guid contextGuid = ((ActivityExecutionContextInfo)ContextActivityUtils.ContextActivity(currentActivity).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
Guid parentContextGuid = Guid.Empty;
if (null != currentActivity.Parent)
parentContextGuid = ((ActivityExecutionContextInfo)ContextActivityUtils.ContextActivity(currentActivity.Parent).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
this.FireExceptionOccured(exp, currentActivity.QualifiedName, originalActivityId, contextGuid, parentContextGuid);
// notify the activity.
//
using (new ServiceEnvironment(currentActivity))
{
using (SetCurrentActivity(currentActivity))
{
using (ActivityExecutionContext executionContext = new ActivityExecutionContext(currentActivity, true))
executionContext.FaultActivity(exp);
}
}
// transaction and batching clean-up on the activity that handles the exception
this.RollbackTransaction(exp, currentActivity);
if ((currentActivity is TransactionScopeActivity) || (exp is PersistenceException))
this.BatchCollection.RollbackBatch(currentActivity);
}
示例3: RaiseException
public void RaiseException(Exception e, Activity activity, string responsibleActivity)
{
// No tracking needed
using (SetCurrentActivity(activity))
{
using (ActivityExecutionContext executionContext = new ActivityExecutionContext(activity, true))
{
executionContext.FaultActivity(e);
}
}
}