SqlWorkflowInstanceStore.InstanceCompletionAction 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定工作流程執行個體完成後要執行的動作。 可能的值為 "DeleteNothing" 和 "DeleteAll"。 預設值為 "DeleteAll"。 如果屬性設定為 "DeleteNothing",持續性提供者會在工作流程執行個體完成後,保留持續性資料庫中所有的執行個體資料和中繼資料。 如果屬性設定為 "DeleteAll",持續性提供者會在工作流程執行個體完成後,刪除所有的執行個體資料和中繼資料。
public:
property System::Activities::DurableInstancing::InstanceCompletionAction InstanceCompletionAction { System::Activities::DurableInstancing::InstanceCompletionAction get(); void set(System::Activities::DurableInstancing::InstanceCompletionAction value); };
public System.Activities.DurableInstancing.InstanceCompletionAction InstanceCompletionAction { get; set; }
member this.InstanceCompletionAction : System.Activities.DurableInstancing.InstanceCompletionAction with get, set
Public Property InstanceCompletionAction As InstanceCompletionAction
屬性值
工作流程執行個體完成後要執行的動作。
範例
下列程式碼範例將示範如何在 SqlWorkflowInstanceStore 中使用 InstanceCompletionAction。
static void Main(string[] args)
{
// Create service host.
WorkflowServiceHost host = new WorkflowServiceHost(new CountingWorkflow(), new Uri(hostBaseAddress));
// Add service endpoint.
host.AddServiceEndpoint("ICountingWorkflow", new BasicHttpBinding(), "");
// Define SqlWorkflowInstanceStoreBehavior:
// Set interval to renew instance lock to 5 seconds.
// Set interval to check for runnable instances to 2 seconds.
// Instance Store does not keep instances after it is completed.
// Select exponential back-off algorithm when retrying to load a locked instance.
// Instance state information is compressed using the GZip compressing algorithm.
SqlWorkflowInstanceStoreBehavior instanceStoreBehavior = new SqlWorkflowInstanceStoreBehavior(connectionString);
instanceStoreBehavior.HostLockRenewalPeriod = new TimeSpan(0, 0, 5);
instanceStoreBehavior.RunnableInstancesDetectionPeriod = new TimeSpan(0, 0, 2);
instanceStoreBehavior.InstanceCompletionAction = InstanceCompletionAction.DeleteAll;
instanceStoreBehavior.InstanceLockedExceptionAction = InstanceLockedExceptionAction.AggressiveRetry;
instanceStoreBehavior.InstanceEncodingOption = InstanceEncodingOption.GZip;
host.Description.Behaviors.Add(instanceStoreBehavior);
// Open service host.
host.Open();
// Create a client that sends a message to create an instance of the workflow.
ICountingWorkflow client = ChannelFactory<ICountingWorkflow>.CreateChannel(new BasicHttpBinding(), new EndpointAddress(hostBaseAddress));
client.start();
Console.WriteLine("(Press [Enter] at any time to terminate host)");
Console.ReadLine();
host.Close();
}
備註
可能的值為 "DeleteNothing" 和 "DeleteAll"。 預設值為 "DeleteAll"。 如果屬性設定為 "DeleteNothing",持續性提供者會在工作流程執行個體完成後,保留持續性資料庫中所有的執行個體資料和中繼資料。 如果屬性設定為 "DeleteAll",持續性提供者會在工作流程執行個體完成後,刪除所有的執行個體資料和中繼資料。