本文整理匯總了C#中System.ServiceModel.Activities.Dispatcher.WorkflowServiceInstance.ScheduleAbortTracking方法的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowServiceInstance.ScheduleAbortTracking方法的具體用法?C# WorkflowServiceInstance.ScheduleAbortTracking怎麽用?C# WorkflowServiceInstance.ScheduleAbortTracking使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ServiceModel.Activities.Dispatcher.WorkflowServiceInstance
的用法示例。
在下文中一共展示了WorkflowServiceInstance.ScheduleAbortTracking方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InitializeInstance
public static WorkflowServiceInstance InitializeInstance(PersistenceContext persistenceContext, Guid instanceId, Activity workflowDefinition, WorkflowIdentity definitionIdentity, IDictionary<XName, InstanceValue> loadedObject, WorkflowCreationContext creationContext,
SynchronizationContext synchronizationContext, WorkflowServiceHost serviceHost, DynamicUpdateMap updateMap = null)
{
Fx.Assert(workflowDefinition != null, "workflowDefinition cannot be null.");
Fx.Assert(serviceHost != null, "serviceHost cannot be null!");
Fx.Assert(instanceId != Guid.Empty, "instanceId cannot be empty.");
WorkflowServiceInstance workflowInstance = new WorkflowServiceInstance(workflowDefinition, definitionIdentity, instanceId, serviceHost, persistenceContext)
{
SynchronizationContext = synchronizationContext
};
// let us initalize the instance level extensions here
workflowInstance.SetupExtensions(serviceHost.WorkflowExtensions);
if (loadedObject != null)
{
InstanceValue stateValue;
object deserializedRuntimeState;
if (!loadedObject.TryGetValue(WorkflowNamespace.Workflow, out stateValue) || stateValue.Value == null)
{
throw FxTrace.Exception.AsError(
new InstancePersistenceException(SR.WorkflowInstanceNotFoundInStore(instanceId)));
}
deserializedRuntimeState = stateValue.Value;
if (loadedObject.TryGetValue(WorkflowServiceNamespace.CreationContext, out stateValue))
{
workflowInstance.creationContext = (WorkflowCreationContext)stateValue.Value;
}
if (persistenceContext.IsSuspended)
{
workflowInstance.state = State.Suspended;
}
try
{
workflowInstance.Initialize(deserializedRuntimeState, updateMap);
}
catch (InstanceUpdateException)
{
// Need to flush the tracking record for the update failure
workflowInstance.ScheduleAbortTracking(true);
throw;
}
if (updateMap != null)
{
workflowInstance.HasBeenUpdated = true;
}
}
else
{
IList<Handle> rootExecutionProperties = null;
IDictionary<string, object> workflowArguments = null;
// Provide default CorrelationScope if root activity is not CorrelationScope
if (!(workflowDefinition is CorrelationScope))
{
rootExecutionProperties = new List<Handle>(1)
{
new CorrelationHandle()
};
}
if (creationContext != null)
{
workflowArguments = creationContext.RawWorkflowArguments;
workflowInstance.creationContext = creationContext;
}
workflowInstance.Initialize(workflowArguments, rootExecutionProperties);
}
return workflowInstance;
}