Beispiel #1
0
 public Session(IResultTransformer resultTransformer, IDao<Bank> bankDao, IDao<LogModel> logDao, ISessionProviderFactory<NHibernateStatelessSession> sessionProviderFactory) 
     : base(resultTransformer)
 {
     this.bankDao = bankDao;
     this.logDao = logDao;
     logSessionProvider = sessionProviderFactory.Build("LOG");
 }
Beispiel #2
0
 public Session(IResultTransformer resultTransformer, IDao <Bank> bankDao, IDao <LogModel> logDao, ISessionProviderFactory <NHibernateStatelessSession> sessionProviderFactory)
     : base(resultTransformer)
 {
     this.bankDao       = bankDao;
     this.logDao        = logDao;
     logSessionProvider = sessionProviderFactory.Build("LOG");
 }
Beispiel #3
0
        public ISession Get <TModel>(IDao <TModel> dao, string sessionAlias)
        {
            Type daoType = dao.GetType();
            Type baseParameterizedType = baseDaoType.MakeGenericType(typeof(TModel));
            bool isAssignableFrom      = baseParameterizedType.IsAssignableFrom(daoType);

            if (!isAssignableFrom)
            {
                return(null);
            }

            ISessionProvider <TSession> sessionProvider = sessionProviderFactory.Build(sessionAlias);
            TSession session = sessionProvider.Current();

            return(session);
        }
Beispiel #4
0
        private ISessionProvider <TSession> BuildSessionProvider(string sessionAlias)
        {
            ISessionProvider <TSession> sessionProvider = decorated.Build(sessionAlias);

            return(sessionProvider);
        }
        public ISession Get <TModel>(IDao <TModel> dao, string sessionAlias)
        {
            Type daoType = dao.GetType();
            Type baseParameterizedType = typeof(ILuceneDao <TModel>);
            bool isAssignableFrom      = baseParameterizedType.IsAssignableFrom(daoType);

            if (!isAssignableFrom)
            {
                return(null);
            }

            ISessionProviderFactory <LuceneSession <TModel> > sessionProviderFactory = serviceRegistry.Get <ISessionProviderFactory <LuceneSession <TModel> > >();
            ISessionProvider <LuceneSession <TModel> >        sessionProvider        = sessionProviderFactory.Build(sessionAlias);
            LuceneSession <TModel> luceneSession = sessionProvider.Current();

            return(luceneSession);
        }