ClientOperation Class
TOC
Collapse the table of content
Expand the table of content

ClientOperation Class

 

Used to modify or extend the execution behavior of a specific contract operation in a client object or client channel object. This class cannot be inherited.

Namespace:   System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

System.Object
  System.ServiceModel.Dispatcher.ClientOperationCompatBase
    System.ServiceModel.Dispatcher.ClientOperation

public sealed class ClientOperation : ClientOperationCompatBase

NameDescription
System_CAPS_pubmethodClientOperation(ClientRuntime, String, String)

Initializes a new instance of the ClientOperation class using the specified ClientRuntime, name, and action values.

System_CAPS_pubmethodClientOperation(ClientRuntime, String, String, String)

Initializes a new instance of the ClientOperation class using the specified ClientRuntime, name, action, and reply action values.

NameDescription
System_CAPS_pubpropertyAction

Gets the action of the operation.

System_CAPS_pubpropertyBeginMethod

Gets or sets the method associated with an asynchronous operation.

System_CAPS_pubpropertyClientParameterInspectors

Gets a collection of parameter inspector objects used to view or modify parameters prior to or subsequent to a client call.

System_CAPS_pubpropertyDeserializeReply

Gets or sets a value that indicates whether the Formatter property value is used to deserialize the reply message.

System_CAPS_pubpropertyEndMethod

Gets or sets the method that implements the asynchronous end method for the operation.

System_CAPS_pubpropertyFaultContractInfos

Gets a collection of FaultContractInfo objects that represent the specified SOAP faults for this operation.

System_CAPS_pubpropertyFormatter

Gets or sets the formatter that serializes objects into messages and deserializes messages into objects.

System_CAPS_pubpropertyIsInitiating

Gets or sets a value that indicates whether a session can be started by a message to this operation.

System_CAPS_pubpropertyIsOneWay

Gets or sets a value that indicates if the operation is a one-way operation.

System_CAPS_pubpropertyIsTerminating

Gets or sets a value that indicates if this operation is the last one in a session.

System_CAPS_pubpropertyName

Gets the name of the operation.

System_CAPS_pubpropertyParameterInspectors

Gets or sets a collection of IParameterInspector objects that can inspect and modify inbound and outbound objects for a particular client method.

System_CAPS_pubpropertyParent

Gets the containing ClientRuntime object.

System_CAPS_pubpropertyReplyAction

Gets the action of the reply message for this operation.

System_CAPS_pubpropertySerializeRequest

Gets or sets a value that specifies whether the Formatter object serializes an outbound message.

System_CAPS_pubpropertySyncMethod

Gets or sets the method that is associated with this operation.

System_CAPS_pubpropertyTaskMethod

Gets or sets the method associated with a task.

System_CAPS_pubpropertyTaskTResult

Gets or sets the type of the result of the method that is associated with a task.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The ClientOperation class is the location for client run-time modifications and insertion point for custom extensions that are scoped to only one service operation. (To modify client run-time behavior for all messages in a contract, use the ClientRuntime class. )

Install ClientOperation modifications using a custom client behavior object, either of type IContractBehavior (to find a particular operation to modify) or of type IOperationBehavior (which can then be applied by creating a custom attribute).

Use the Operations property to locate the ClientOperation object that represents a particular service operation.

For more information about clients and the client architecture, see Accessing Services Using a Client and Client Architecture. For more information about customizing the client runtime, see Extending Clients. For more information about using behaviors, see Configuring and Extending the Runtime with Behaviors.

The following properties enable you to insert custom objects or modify the client execution behavior:

  • Use the Formatter property to insert a custom IClientMessageFormatter implementation for an operation or modify the current formatter.

  • Use the ParameterInspectors property to insert a custom IParameterInspector implementation or to modify the current one.

  • Use the SerializeRequest property to control who serializes an outbound message.

  • Use the DeserializeReply property to control who deserializes an inbound message.

  • Use the Action property to access the WS-Addressing action of the request message and the ReplyAction property to access the response message action.

  • Use the BeginMethod and EndMethod to specify which client methods are associated with an asynchronous operation.

  • Use the FaultContractInfos property to get a collection of specified types that can appear in SOAP faults as the detail type.

  • Use the IsInitiating and IsTerminating properties to control whether a session is initiated or is torn down, respectively, when the operation is called.

  • Use the IsOneWay property to control whether the client waits for a response before completing the invocation.

  • Use the Parent property to obtain the containing ClientRuntime object.

  • Use the Name property to get the name of the operation.

  • Use the SyncMethod property to control which method is mapped to the operation.

The following code example shows an System.ServiceModel.Description.IEndpointBehavior inserting a custom parameter inspector into each ClientOperation in the ClientRuntime.Operations property.

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

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft