ClientRuntime.Operations 属性

定义

获取客户端的客户端操作的集合。

public:
 property System::Collections::Generic::SynchronizedKeyedCollection<System::String ^, System::ServiceModel::Dispatcher::ClientOperation ^> ^ Operations { System::Collections::Generic::SynchronizedKeyedCollection<System::String ^, System::ServiceModel::Dispatcher::ClientOperation ^> ^ get(); };
public:
 property System::Collections::ObjectModel::KeyedCollection<System::String ^, System::ServiceModel::Dispatcher::ClientOperation ^> ^ Operations { System::Collections::ObjectModel::KeyedCollection<System::String ^, System::ServiceModel::Dispatcher::ClientOperation ^> ^ get(); };
public System.Collections.Generic.SynchronizedKeyedCollection<string,System.ServiceModel.Dispatcher.ClientOperation> Operations { get; }
public System.Collections.ObjectModel.KeyedCollection<string,System.ServiceModel.Dispatcher.ClientOperation> Operations { get; }
member this.Operations : System.Collections.Generic.SynchronizedKeyedCollection<string, System.ServiceModel.Dispatcher.ClientOperation>
member this.Operations : System.Collections.ObjectModel.KeyedCollection<string, System.ServiceModel.Dispatcher.ClientOperation>
Public ReadOnly Property Operations As SynchronizedKeyedCollection(Of String, ClientOperation)
Public ReadOnly Property Operations As KeyedCollection(Of String, ClientOperation)

属性值

SynchronizedKeyedCollection<String,ClientOperation>
KeyedCollection<String,ClientOperation>

ClientOperation 对象的同步集合。

示例

在下面的代码示例中,System.ServiceModel.Description.IEndpointBehavior 通过将 System.ServiceModel.Dispatcher.IParameterInspector 添加到 ClientOperation 属性中的每个 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

注解

使用 Operations 属性可以获取此客户端的、可用于附加扩展对象的所有操作的集合,而这些扩展对象可以检查或修改局限于特定操作的消息和行为。 有关详细信息,请参阅 ClientOperation

适用于