I have the need for a custom IOperationInvoker in my service. I have it working just fine, but I don't particularly like the idea that in order to apply it to a given operation I have to make it an attribute. I can't seem to find any documentation on how to have it config based (similar to a MessageInspector on an endpoint).
I created an CustomBehavior that implements an IEndpointBehavior. In the ApplyDispathBehavior I have the following:
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
foreach (var operation in endpointDispatcher.DispatchRuntime.Operations)
{
operation.Invoker = new MockServiceOperationInvoker() {Invoker=operation.Invoker };
}
}
However, the custom invoker doesn't seem to "stick". Could the changes be getting cleared later in the life cycle?
Everything does work if I make the behavior an attribute, but I would rather not do that. Does anyone know of a better way to apply a custom OperationBInvoker to all methods in a given endpoint?
Much thanks!