예제 #1
0
        private object CreateChannelProxy(Type serviceContract, IClientChannel channel)
        {
            // ensure we only access the proxy generator in a thread-safe manner
            lock (_proxyGenerator)
            {
                //These interceptors used to be initialized once and shared amongst all
                //the clients.  #7179 changed that, so if we find another solution for it
                //later, we could make them shared again.
                var interceptors = new List <IInterceptor>();
                ApplyInterceptors(serviceContract, interceptors);

                var options = new ProxyGenerationOptions();

                // create and return proxy
                // note: _proxyGenerator does internal caching based on service contract
                // so subsequent calls based on the same contract will be fast
                // note: important to proxy IDisposable too, otherwise channels can't get disposed!!!
                var aopChain = new AopInterceptorChain(interceptors);
                return(_proxyGenerator.CreateInterfaceProxyWithTarget(
                           serviceContract,
                           new[] { serviceContract, typeof(IDisposable) },
                           channel,
                           options,
                           aopChain));
            }
        }
예제 #2
0
 internal IntermediateInvocation(AopInterceptorChain owner, IInvocation rootInvocation)
 {
     _owner          = owner;
     _rootInvocation = rootInvocation;
 }