private static TService InterfaceProxyWithTarget <TService>(TService implementationInstance, IInterceptronInterceptor interceptor) where TService : class { var proxy = System.Reflection.DispatchProxy.Create <TService, DispatcherProxyInterceptorAdapter>(); var dispatcherProxyInterceptorAdapter = proxy as DispatcherProxyInterceptorAdapter; dispatcherProxyInterceptorAdapter.Interceptor = interceptor; dispatcherProxyInterceptorAdapter.Target = implementationInstance; return(proxy); }
public DynamicProxyInterceptorAdapter(IInterceptronInterceptor interceptor) { Interceptor = interceptor ?? throw new ArgumentNullException(nameof(interceptor)); }