コード例 #1
0
        /// <summary>
        /// 获取业务代理
        /// </summary>
        /// <typeparam name="T">被代理业务对象类型</typeparam>
        /// <returns></returns>
        public static T WaterBussiness <T>()
            where T : MarshalByRefObject
        {
            var obj = Activator.CreateInstance <T>();
            BussinessFactory proxy = new BussinessFactory(obj);

            return(proxy.GetTransparentProxy() as T);
        }
コード例 #2
0
 /// <summary>
 /// 获取业务代理
 /// </summary>
 /// <param name="businessType">被代理业务对象类型</param>
 /// <returns></returns>
 public static object WaterBussiness(Type bussinessType)
 {
     try {
         var tt  = Activator.CreateInstance(bussinessType);
         var obj = Activator.CreateInstance(bussinessType) as MarshalByRefObject;
         BussinessFactory proxy = new BussinessFactory(obj);
         return(proxy.GetTransparentProxy());
     } catch (Exception ex) {
         return(ex.ToString());
     }
 }