コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dao"></param>
        /// <returns></returns>
        public static IDao NewInstance(Dao dao)
        {
            ProxyGenerator proxyGenerator = new ProxyGenerator();
            IInterceptor   handler        = new DaoProxy(dao);

//			Type[] interfaces = {dao.DaoInterface, typeof(IDao)};
            return(proxyGenerator.CreateInterfaceProxyWithTarget(dao.DaoInstance, handler));
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dao"></param>
        /// <returns></returns>
        public static IDao NewInstance(Dao dao)
        {
            ProxyGenerator proxyGenerator = new ProxyGenerator();
            IInterceptor   handler        = new DaoProxy(dao);

            Type[] interfaces = { dao.DaoInterface, typeof(IDao) };

            return(proxyGenerator.CreateProxy(interfaces, handler, dao.DaoInstance) as IDao);
        }
コード例 #3
0
 /// <summary>
 /// Initialize dao object.
 /// </summary>
 public void Initialize(DaoManager daoManager)
 {
     try
     {
         _daoManager        = daoManager;
         _daoImplementation = TypeUtils.ResolveType(this.Implementation);
         _daoInterface      = TypeUtils.ResolveType(this.Interface);
         // Create a new instance of the Dao object.
         _daoInstance = _daoImplementation.GetConstructor(Type.EmptyTypes).Invoke(null) as IDao;
         _proxy       = DaoProxy.NewInstance(this);
     }
     catch (Exception e)
     {
         throw new ConfigurationErrorsException(string.Format("Error configuring DAO. Cause: {0}", e.Message), e);
     }
 }
コード例 #4
0
ファイル: DaoProxy.cs プロジェクト: zuifengke/windy-ibatisnet
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dao"></param>
        /// <returns></returns>
        public static IDao NewInstance(Dao dao)
        {
            ProxyGenerator proxyGenerator = new ProxyGenerator();
            IInterceptor handler = new DaoProxy(dao);
            Type[] interfaces = {dao.DaoInterface, typeof(IDao)};

            return (proxyGenerator.CreateProxy(interfaces, handler, dao.DaoInstance) as IDao);
        }