WorkflowHostingEndpoint.OnGetInstanceId(Object[], OperationContext) Метод

Определение

Переопределите для возврата идентификатора экземпляра созданного рабочего процесса.

protected public:
 virtual Guid OnGetInstanceId(cli::array <System::Object ^> ^ inputs, System::ServiceModel::OperationContext ^ operationContext);
protected internal virtual Guid OnGetInstanceId (object[] inputs, System.ServiceModel.OperationContext operationContext);
abstract member OnGetInstanceId : obj[] * System.ServiceModel.OperationContext -> Guid
override this.OnGetInstanceId : obj[] * System.ServiceModel.OperationContext -> Guid
Protected Friend Overridable Function OnGetInstanceId (inputs As Object(), operationContext As OperationContext) As Guid

Параметры

inputs
Object[]

Входные данные для операции службы.

operationContext
OperationContext

Контекст операции для операции службы.

Возвращаемое значение

Идентификатор экземпляра для вновь созданного экземпляра рабочего процесса.

Примеры

В следующем примере показана реализация метода OnGetInstanceId.

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

Комментарии

Возвращает значение null для указания того, что идентификатор экземпляра должен быть создан автоматически.

Применяется к