次の方法で共有


SqlWorkflowInstanceStore.InstanceEncodingOption プロパティ

定義

インスタンス データを圧縮する必要があるかどうかを示す値を指定します。

public:
 property System::Activities::DurableInstancing::InstanceEncodingOption InstanceEncodingOption { System::Activities::DurableInstancing::InstanceEncodingOption get(); void set(System::Activities::DurableInstancing::InstanceEncodingOption value); };
public System.Activities.DurableInstancing.InstanceEncodingOption InstanceEncodingOption { get; set; }
member this.InstanceEncodingOption : System.Activities.DurableInstancing.InstanceEncodingOption with get, set
Public Property InstanceEncodingOption As InstanceEncodingOption

プロパティ値

指定できる値は、"None" と "GZip" です。 既定値は "None" です。

SqlWorkflowInstanceStore で InstanceEncodingOption を使用するコード サンプルを次に示します。

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();
}

注釈

値が "GZip" に設定されている場合、インスタンス データは GZip アルゴリズムを使用して圧縮されます。

適用対象