本文整理匯總了VB.NET中System.Workflow.Runtime.Hosting.WorkflowPersistenceService.SaveWorkflowInstanceState方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET WorkflowPersistenceService.SaveWorkflowInstanceState方法的具體用法?VB.NET WorkflowPersistenceService.SaveWorkflowInstanceState怎麽用?VB.NET WorkflowPersistenceService.SaveWorkflowInstanceState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了WorkflowPersistenceService.SaveWorkflowInstanceState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例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 Overrides Sub SaveWorkflowInstanceState(ByVal rootActivity As System.Workflow.ComponentModel.Activity, ByVal unlock As Boolean)
Dim contextGuid As Guid = CType(rootActivity.GetValue(Activity.ActivityContextGuidProperty), Guid)
Console.WriteLine("Saving instance: 0}" + vbLf, contextGuid)
SerializeToFile( _
WorkflowPersistenceService.GetDefaultSerializedForm(rootActivity), contextGuid)
' See when the next timer (Delay activity) for this workflow will expire
Dim timers As TimerEventSubscriptionCollection = CType(rootActivity.GetValue(TimerEventSubscriptionCollection.TimerCollectionProperty), TimerEventSubscriptionCollection)
Dim subscription As TimerEventSubscription = timers.Peek()
If subscription IsNot Nothing Then
' Set a system timer to automatically reload this workflow when it's next timer expires
Dim timeDifference As TimeSpan = subscription.ExpiresAt - DateTime.UtcNow
Dim callback As TimerCallback = New TimerCallback(AddressOf ReloadWorkflow)
Dim timer As New System.Threading.Timer( _
callback, _
subscription.WorkflowInstanceId, _
CType(IIf(timeDifference < TimeSpan.Zero, TimeSpan.Zero, timeDifference), TimeSpan), _
New TimeSpan(-1))
End If
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Workflow.Runtime.Hosting,代碼行數:22,代碼來源:WorkflowPersistenceService.SaveWorkflowInstanceState