次の方法で共有


ClientPipelineOptions.AddPolicy(PipelinePolicy, PipelinePosition) Method

Definition

Adds the provided PipelinePolicy to the default ClientPipeline.

public void AddPolicy (System.ClientModel.Primitives.PipelinePolicy policy, System.ClientModel.Primitives.PipelinePosition position);
member this.AddPolicy : System.ClientModel.Primitives.PipelinePolicy * System.ClientModel.Primitives.PipelinePosition -> unit
Public Sub AddPolicy (policy As PipelinePolicy, position As PipelinePosition)

Parameters

policy
PipelinePolicy

The PipelinePolicy to add to the pipeline.

position
PipelinePosition

The position of the policy in the pipeline.

Exceptions

Thrown when the provided policy is null.

Remarks

For a policy to run once per invocation of Send(PipelineMessage), use PerCall, which will insert the policy before the pipeline's RetryPolicy. For a policy to run once per retry attempt, use PerTry, which will insert the policy after the pipeline's RetryPolicy. To ensure that a policy runs after all other policies in the pipeline have viewed the Request and before all other policies view the Response, use BeforeTransport. Changes made to Request by a before-transport policy will not be visible to any logging policies that come before it in the pipeline.

Applies to