How do I apply behaviors to the callback portion of a callback contract?
If you were going to apply a behavior to the non-callback portion of the callback contract, you’d do so through an IContractBehavior attached to the relevant part of the service description. On the IContractBehavior you’d implement two methods, ApplyClientBehavior and ApplyDispatchBehavior, for modifying or extending the behavior of the contract. Let’s take a look at those two methods.
void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, ClientRuntime clientRuntime); void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime);
With each of the methods you get a copy of the contract, the endpoint that supports the contract, and the runtime behind the endpoint. These objects that support the forward contract are also linked to the objects that support the backwards contract.
On the contract description there is a CallbackContractType that you can use to get the description of the callback contract.
On the client runtime there is a CallbackDispatchRuntime that gives you the dispatch runtime for the callback from the service.
On the dispatch runtime there is a CallbackClientRuntime that gives you the client runtime for the callback to the client.