本文整理匯總了C#中System.Workflow.Runtime.Hosting.WorkflowPersistenceService.SaveWorkflowInstanceState方法的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowPersistenceService.SaveWorkflowInstanceState方法的具體用法?C# WorkflowPersistenceService.SaveWorkflowInstanceState怎麽用?C# WorkflowPersistenceService.SaveWorkflowInstanceState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了WorkflowPersistenceService.SaveWorkflowInstanceState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SaveWorkflowInstanceState
// Save the workflow instance state at the point of persistence with option of locking the instance state if it is shared
// across multiple runtimes or multiple phase instance updates
protected override void SaveWorkflowInstanceState(Activity rootActivity, bool unlock)
{
// Save the workflow
Guid contextGuid = (Guid)rootActivity.GetValue(Activity.ActivityContextGuidProperty);
Console.WriteLine("Saving instance: {0}\n", contextGuid);
SerializeToFile(
WorkflowPersistenceService.GetDefaultSerializedForm(rootActivity), contextGuid);
// See when the next timer (Delay activity) for this workflow will expire
TimerEventSubscriptionCollection timers = (TimerEventSubscriptionCollection)rootActivity.GetValue(TimerEventSubscriptionCollection.TimerCollectionProperty);
TimerEventSubscription subscription = timers.Peek();
if (subscription != null)
{
// Set a system timer to automatically reload this workflow when its next timer expires
TimerCallback callback = new TimerCallback(ReloadWorkflow);
TimeSpan timeDifference = subscription.ExpiresAt - DateTime.UtcNow;
System.Threading.Timer timer = new System.Threading.Timer(
callback,
subscription.WorkflowInstanceId,
timeDifference < TimeSpan.Zero ? TimeSpan.Zero : timeDifference,
new TimeSpan(-1));
}
}
開發者ID:.NET開發者,項目名稱:System.Workflow.Runtime.Hosting,代碼行數:25,代碼來源:WorkflowPersistenceService.SaveWorkflowInstanceState