private void WireInvocationEventHandlers() { foreach (ProxyableService service in ServiceClients) { ServiceProxyClient client = service.Property <ServiceProxyClient>("Client"); client.InvocationException += (o, a) => InvocationExceptionHandler(o, a); client.InvokedMethod += (o, a) => InvocationHandler(o, a); } }
private static void SubscribeToInvocationExceptions <T>(T result, EventHandler <ServiceProxyInvokeEventArgs> invocationExceptionHandler) { ServiceProxyClient client = result.Property <ServiceProxyClient>("Client"); // Client is defined on the generated proxy class, and this is using reflection to access it; magical knowledge client.Subscribe(nameof(ServiceProxyClient.InvocationException), invocationExceptionHandler); }