SqlWorkflowInstanceStore.Promote Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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))
Parameters
- name
- String
The name of the promotion itself.
- promoteAsVariant
- IEnumerable<XName>
The properties that must be promoted as variants.
- promoteAsBinary
- IEnumerable<XName>
The properties that must be promoted as a binary stream.
Remarks
Example
The following code sample demonstrates using Promote in a 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();
}