Applying behaviors on the client channel

When we need to modify or see the message before its sent or after its received, we generally use a Message inspector. However sometimes we want it to be a bit more granular. One such requirement was to perform some operations for 2-way calls and a different set of operations for one way calls. For this you can probably use extensibility points like the IParameterInspector and attach the required inspector to those appropriate operations.

[code:c#]

public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime){    foreach (ClientOperation operation in clientRuntime.Operations)    {        if (!operation.IsOneWay)        {            operation.ParameterInspectors.Add(new TwoWayBehavior());        }        else        {            operation.ParameterInspectors.Add(new OneWayBehavior());        }    }}

[/code]

Here is the source.(3.13 kb)