示例#1
0
        /// <summary>
        /// Starts setting up a passthrough object
        /// </summary>
        /// <param name="innerType">Inner object type</param>
        /// <returns></returns>
        public Passthrough Create(Type innerType)
        {
            object inner = Activator.CreateInstance(innerType);

            _interceptor = new PassthroughInterceptor(inner);
            return(this);
        }
示例#2
0
        internal static T As <T>(PassthroughInterceptor passthrough)
        {
            T    proxy = default(T);
            Type type  = passthrough.Inner.GetType();

            proxy = GenerateProxy <T>(type, passthrough);
            return(proxy);
        }
示例#3
0
        private static TInterface GenerateProxy <TInterface>(Type type, PassthroughInterceptor passthrough)
        {
            ProxyGenerator generator = GetProxyGenerator(type);

            return(generator.CreateInterfaceProxyWithoutTarget <TInterface>(passthrough));
        }
示例#4
0
 public Passthrough Create(object inner)
 {
     _interceptor = new PassthroughInterceptor(inner);
     return(this);
 }