Export (0) Print
Expand All

SqlWorkflowInstanceStore.Promote Method

Associates the specified properties with a workflow instance so that you can query for instances based on specific values for these properties. These properties that can be used in external queries can be of simple types (for example: Int64, String, and so on) or of a serialized binary type (byte[]). Binary properties are typically used to store tracking data.

Namespace:  System.Activities.DurableInstancing
Assembly:  System.Activities.DurableInstancing (in System.Activities.DurableInstancing.dll)

member Promote : 
        name:string * 
        promoteAsVariant:IEnumerable<XName> * 
        promoteAsBinary:IEnumerable<XName> -> unit

Parameters

name
Type: System.String

The name of the promotion itself.

promoteAsVariant
Type: System.Collections.Generic.IEnumerable(XName)

The properties that must be promoted as variants.

promoteAsBinary
Type: System.Collections.Generic.IEnumerable(XName)

The properties that must be promoted as a binary stream.

The following code sample demonstrates using Promote in a SqlWorkflowInstanceStore. This example is from the SQLStoreExtensibility sample.

static void Main(string[] args)
{
    // Create service host.
    WorkflowServiceHost host = new WorkflowServiceHost(CountingWorkflow(), new Uri(hostBaseAddress));

    // Add service endpoint.
    host.AddServiceEndpoint("ICountingWorkflow", new BasicHttpBinding(), "");

    // Define SqlWorkflowInstanceStore and assign it to host.
    SqlWorkflowInstanceStoreBehavior store = new SqlWorkflowInstanceStoreBehavior(connectionString);
    List<XName> variantProperties = new List<XName>()
    {   
        xNS.GetName("Count")
    };
    store.Promote("CountStatus", variantProperties, null);

    host.Description.Behaviors.Add(store);

    host.WorkflowExtensions.Add<CounterStatus>(() => new CounterStatus());
    host.Open(); // This sample needs to be run with Admin privileges. 
                 // Otherwise the channel listener is not allowed to open ports. 
                 // See sample documentation for details. 

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft