ClientOperation.ParameterInspectors 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置 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 实现或修改当前实现。 对于请求,参数检查器是按它们添加到集合的顺序来调用的;对于回复,则按相反的顺序调用。