I want to add my own IOperationInvoker to a wcf client but can't get it to work. I have this
class ClientProgram
{
static void Main()
{
CreateClient().SomeMethod();
}
private static MyServiceClient CreateClient()
{
var client = new MyServiceClient(new NetTcpBinding(), new EndpointAddress"net.tcp://localhost:12345/MyService"));
// I guess this is where the magic should happen
return client;
}
}
public class MyOperationInvoker : IOperationInvoker
{
private readonly IOperationInvoker _innerOperationInvoker;
public MyOperationInvoker(IOperationInvoker innerOperationInvoker)
{
_innerOperationInvoker = innerOperationInvoker;
}
public object Invoke(object instance, object[] inputs, out object[] outputs)
{
Console.WriteLine("Intercepting...");
return _innerOperationInvoker.Invoke(instance, inputs, out outputs);
}
// Other methods not important
}