共用方式為


ClientOperation.ParameterInspectors 屬性

定義

取得或設定 IParameterInspector 物件的集合,這些物件可以檢查和修改特定用戶端方法的傳入及傳出物件。

public:
 property System::Collections::Generic::SynchronizedCollection<System::ServiceModel::Dispatcher::IParameterInspector ^> ^ ParameterInspectors { System::Collections::Generic::SynchronizedCollection<System::ServiceModel::Dispatcher::IParameterInspector ^> ^ get(); };
public System.Collections.Generic.SynchronizedCollection<System.ServiceModel.Dispatcher.IParameterInspector> ParameterInspectors { get; }
member this.ParameterInspectors : System.Collections.Generic.SynchronizedCollection<System.ServiceModel.Dispatcher.IParameterInspector>
Public ReadOnly Property ParameterInspectors As SynchronizedCollection(Of IParameterInspector)

屬性值

IParameterInspector 實作的集合。

範例

下列程式碼範例將示範 System.ServiceModel.Description.IEndpointBehavior 如何將自訂參數偵測器插入至 ClientOperation 屬性中的每個 ClientRuntime.Operations

#region IEndpointBehavior Members
public void AddBindingParameters(
  ServiceEndpoint endpoint, BindingParameterCollection bindingParameters
) { return; }

public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
  clientRuntime.MessageInspectors.Add(new Inspector());
  foreach (ClientOperation op in clientRuntime.Operations)
    op.ParameterInspectors.Add(new Inspector());
}

public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
  endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new Inspector());
  foreach (DispatchOperation op in endpointDispatcher.DispatchRuntime.Operations)
    op.ParameterInspectors.Add(new Inspector());
}

public void Validate(ServiceEndpoint endpoint){ return; }
#Region "IEndpointBehavior Members"
    Public Sub AddBindingParameters(ByVal endpoint As ServiceEndpoint, ByVal bindingParameters _
                                    As BindingParameterCollection) Implements IEndpointBehavior.AddBindingParameters
        Return
    End Sub

    Public Sub ApplyClientBehavior(ByVal endpoint As ServiceEndpoint, ByVal clientRuntime As ClientRuntime) _
    Implements IEndpointBehavior.ApplyClientBehavior
        clientRuntime.MessageInspectors.Add(New Inspector())
        For Each op As ClientOperation In clientRuntime.Operations
            op.ParameterInspectors.Add(New Inspector())
        Next op
    End Sub

    Public Sub ApplyDispatchBehavior(ByVal endpoint As ServiceEndpoint, ByVal endpointDispatcher As  _
                                     EndpointDispatcher) Implements IEndpointBehavior.ApplyDispatchBehavior
        endpointDispatcher.DispatchRuntime.MessageInspectors.Add(New Inspector())
        For Each op As DispatchOperation In endpointDispatcher.DispatchRuntime.Operations
            op.ParameterInspectors.Add(New Inspector())
        Next op
    End Sub

Public Sub Validate(ByVal endpoint As ServiceEndpoint) Implements IEndpointBehavior.Validate
    Return
End Sub

備註

使用 ParameterInspectors 屬性,即可插入自訂 IParameterInspector 實作或修改目前的實作。 參數偵測器會依照加入要求之集合的順序,以及依照回覆的相反順序叫用。

適用於