Esempio n. 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.CreateProxy(interfaces, handler, dao.DaoInstance) as IDao);
        }
Esempio n. 2
0
 /// <summary>
 /// Create a new proxy for the Dao
 /// </summary>
 /// <param name="dao">The dao object to proxy</param>
 public DaoProxy(Dao dao)
 {
     _daoImplementation = dao;
 }
Esempio n. 3
0
        /// <summary>
        /// Register a dao
        /// </summary>
        /// <param name="dao"></param>
        internal void RegisterDao(Dao dao)
        {
            if ( DaoMap.Contains(dao.DaoInterface) )
            {
                throw new DataException("More than one implementation for '" + dao.Interface + "' was configured.  " +
                    "Only one implementation per context is allowed.");
            }
            DaoMap.Add(dao.DaoInterface, dao);

            _daoImplementationMap.Add(dao.Proxy, dao);
            _daoImplementationMap.Add(dao.DaoInstance, dao);
        }