SqlWorkflowInstanceStore.Promote 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将指定的属性与工作流实例相关联,以便能够基于这些属性的特定值查询实例。 可在外部查询中使用的这些属性可以是简单的类型(例如:Int64、String 等),也可以是序列化的二进制类型 (byte[])。 二进制属性通常用于存储跟踪数据。
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))
参数
- name
- String
提升本身的名称。
- promoteAsVariant
- IEnumerable<XName>
必须以变体形式提升的属性。
- promoteAsBinary
- IEnumerable<XName>
必须以二进制流形式提升的属性。
注解
示例
下面的代码示例演示如何在 SqlWorkflowInstanceStore 中使用 Promote。
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();
}