示例#1
0
        /// <summary>
        /// 取得代理實體
        /// </summary>
        /// <typeparam name="TObject">代理類型別</typeparam>
        /// <param name="realSubject">被代理類別實體</param>
        /// <returns></returns>
        public static TObject GetProxyInstance <TObject>(TObject realSubject)
            where TObject : MarshalByRefObject
        {
            var proxy = new DynamicProxy <TObject>(realSubject);

            return(proxy.GetTransparentProxy() as TObject);
        }
示例#2
0
 /// <summary>
 /// 取得代理實體
 /// </summary>
 /// <typeparam name="TObject">代理類型別</typeparam>
 /// <param name="realSubject">被代理類別實體</param>
 /// <returns></returns>
 public static TObject GetProxyInstance <TObject>(Func <TObject> realSubject)
     where TObject : class
 {
     return(DynamicProxy <TObject> .CreateProxy(realSubject));
 }