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