WorkflowHostingEndpoint Klasse
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Eine abstrakte Implementierung von ServiceEndpoint. Leiten Sie diese Klasse ab, um Verträge verfügbar zu machen, die die Erstellung von Workflows und die Wiederaufnahme von Lesezeichen unterstützen.
public ref class WorkflowHostingEndpoint abstract : System::ServiceModel::Description::ServiceEndpoint
public abstract class WorkflowHostingEndpoint : System.ServiceModel.Description.ServiceEndpoint
type WorkflowHostingEndpoint = class
inherit ServiceEndpoint
Public MustInherit Class WorkflowHostingEndpoint
Inherits ServiceEndpoint
- Vererbung
- Abgeleitet
Beispiele
Das folgende Beispiel zeigt, wie eine Klasse von der WorkflowHostingEndpoint Klasse abgeleitet wird.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.ServiceModel;
using System.ServiceModel.Activities;
using System.ServiceModel.Channels;
namespace Microsoft.Samples.WF.CreationEndpoint
{
public class CreationEndpoint : WorkflowHostingEndpoint
{
static Uri defaultBaseUri;
public CreationEndpoint(Binding binding, EndpointAddress address)
: base(typeof(IWorkflowCreation), binding, address)
{
}
public CreationEndpoint():this (GetDefaultBinding(),
new EndpointAddress(new Uri(DefaultBaseUri, new Uri(Guid.NewGuid().ToString(), UriKind.Relative))))
{
}
static Uri DefaultBaseUri
{
get
{
if (defaultBaseUri == null)
{
defaultBaseUri = new Uri(string.Format(CultureInfo.InvariantCulture, "net.pipe://localhost/workflowCreationEndpoint/{0}/{1}",
Process.GetCurrentProcess().Id,
AppDomain.CurrentDomain.Id));
}
return defaultBaseUri;
}
}
//defaults to NetNamedPipeBinding
public static Binding GetDefaultBinding()
{
return new NetNamedPipeBinding(NetNamedPipeSecurityMode.None) { TransactionFlow = true };
}
protected override Guid OnGetInstanceId(object[] inputs, OperationContext operationContext)
{
//Create was called by client
if (operationContext.IncomingMessageHeaders.Action.EndsWith("Create"))
{
return Guid.Empty;
}
//CreateWithInstanceId was called by client
else if (operationContext.IncomingMessageHeaders.Action.EndsWith("CreateWithInstanceId"))
{
return (Guid)inputs[1];
}
else
{
throw new InvalidOperationException("Invalid Action: " + operationContext.IncomingMessageHeaders.Action);
}
}
protected override WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext)
{
WorkflowCreationContext creationContext = new WorkflowCreationContext();
if (operationContext.IncomingMessageHeaders.Action.EndsWith("Create"))
{
Dictionary<string, object> arguments = (Dictionary<string, object>)inputs[0];
if (arguments != null && arguments.Count > 0)
{
foreach (KeyValuePair<string, object> pair in arguments)
{
//arguments to pass to the workflow
creationContext.WorkflowArguments.Add(pair.Key, pair.Value);
}
}
//reply to client with instanceId
responseContext.SendResponse(instanceId, null);
}
else if (operationContext.IncomingMessageHeaders.Action.EndsWith("CreateWithInstanceId"))
{
Dictionary<string, object> arguments = (Dictionary<string, object>)inputs[0];
if (arguments != null && arguments.Count > 0)
{
foreach (KeyValuePair<string, object> pair in arguments)
{
//arguments to pass to workflow
creationContext.WorkflowArguments.Add(pair.Key, pair.Value);
}
}
}
else
{
throw new InvalidOperationException("Invalid Action: " + operationContext.IncomingMessageHeaders.Action);
}
return creationContext;
}
}
//service contract exposed from the endpoint
[ServiceContract(Name = "IWorkflowCreation")]
public interface IWorkflowCreation
{
[OperationContract(Name = "Create")]
Guid Create(IDictionary<string, object> inputs);
[OperationContract(Name = "CreateWithInstanceId", IsOneWay=true)]
void CreateWithInstanceId(IDictionary<string, object> inputs, Guid instanceId);
}
}
Konstruktoren
| Name | Beschreibung |
|---|---|
| WorkflowHostingEndpoint(Type, Binding, EndpointAddress) |
Erstellt eine neue Instanz der WorkflowHostingEndpoint Klasse mit dem angegebenen Vertragstyp, der Bindung und der Endpunktadresse. |
| WorkflowHostingEndpoint(Type) |
Erstellt eine neue Instanz der WorkflowHostingEndpoint Klasse mit dem angegebenen Vertragstyp. |
Eigenschaften
| Name | Beschreibung |
|---|---|
| Address |
Ruft die Endpunktadresse für den Dienstendpunkt ab oder legt sie fest. (Geerbt von ServiceEndpoint) |
| Behaviors |
Ruft das Verhalten für den Dienstendpunkt ab. (Geerbt von ServiceEndpoint) |
| Binding |
Dient zum Abrufen oder Festlegen der Bindung für den Dienstendpunkt. (Geerbt von ServiceEndpoint) |
| Contract |
Ruft den Vertrag für den Dienstendpunkt ab. (Geerbt von ServiceEndpoint) |
| CorrelationQueries |
Ruft eine Auflistung von CorrelationQuery Instanzen ab. |
| EndpointBehaviors |
Ruft das Endpunktverhalten für den Dienst ab. (Geerbt von ServiceEndpoint) |
| IsSystemEndpoint |
Ruft ab oder legt fest, ob der Dienstendpunkt vom System generiert wird, im Gegensatz zu benutzerdefinierten. (Geerbt von ServiceEndpoint) |
| ListenUri |
Ruft den URI ab, an dem der Dienstendpunkt lauscht, oder legt ihn fest. (Geerbt von ServiceEndpoint) |
| ListenUriMode |
Ruft ab oder legt fest, wie der Transport den URI verarbeitet, der für den Dienst bereitgestellt wird, um aufzuhören. (Geerbt von ServiceEndpoint) |
| Name |
Ruft den Namen des Dienstendpunkts ab oder legt den Namen fest. (Geerbt von ServiceEndpoint) |
Methoden
| Name | Beschreibung |
|---|---|
| Equals(Object) |
Bestimmt, ob das angegebene Objekt dem aktuellen Objekt entspricht. (Geerbt von Object) |
| GetHashCode() |
Dient als Standardhashfunktion. (Geerbt von Object) |
| GetType() |
Ruft die Type der aktuellen Instanz ab. (Geerbt von Object) |
| MemberwiseClone() |
Erstellt eine flache Kopie der aktuellen Object. (Geerbt von Object) |
| OnGetCreationContext(Object[], OperationContext, Guid, WorkflowHostingResponseContext) |
Überschreiben, um eine neue WorkflowCreationContext Instanz zu erstellen. |
| OnGetInstanceId(Object[], OperationContext) |
Überschreiben, um die Instanz-ID für die zu erstellende Workflowinstanz zurückzugeben. |
| OnResolveBookmark(Object[], OperationContext, WorkflowHostingResponseContext, Object) |
Überschreiben, um eine Textmarke zurückzugeben, die in der Workflowinstanz fortgesetzt werden soll. |
| ToString() |
Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt. (Geerbt von Object) |