SqlWorkflowInstanceStore.Promote Méthode

Définition

Associe les propriétés spécifiées à une instance de flux de travail afin que vous puissiez interroger les instances à partir de valeurs spécifiques pour ces propriétés. Ces propriétés qui peuvent être utilisées dans les requêtes externes peuvent être de types simples (par exemple: Int64, String, etc.) ou d'un type binaire sérialisé (byte[]). Les propriétés Binary sont utilisées en général pour stocker les données de suivi.

public:
 void Promote(System::String ^ name, System::Collections::Generic::IEnumerable<System::Xml::Linq::XName ^> ^ promoteAsVariant, System::Collections::Generic::IEnumerable<System::Xml::Linq::XName ^> ^ promoteAsBinary);
public void Promote (string name, System.Collections.Generic.IEnumerable<System.Xml.Linq.XName> promoteAsVariant, System.Collections.Generic.IEnumerable<System.Xml.Linq.XName> promoteAsBinary);
member this.Promote : string * seq<System.Xml.Linq.XName> * seq<System.Xml.Linq.XName> -> unit
Public Sub Promote (name As String, promoteAsVariant As IEnumerable(Of XName), promoteAsBinary As IEnumerable(Of XName))

Paramètres

name
String

Nom de la promotion elle-même.

promoteAsVariant
IEnumerable<XName>

Propriétés qui doivent être promues comme variantes.

promoteAsBinary
IEnumerable<XName>

Propriétés qui doivent être promues comme flux binaire.

Remarques

Exemple

L'exemple de code suivant montre comment utiliser Promote dans un SqlWorkflowInstanceStore.

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

S’applique à