protected override void Init()
        {
            Kernel.Register(Component.For(typeof(IRepository<>)).ImplementedBy(typeof(NHRepository<>)));

            MultipleNHibernateUnitOfWorkFactory unitOfWorkFactory = new MultipleNHibernateUnitOfWorkFactory();
            foreach (NHibernateUnitOfWorkFacilityConfig config in configs)
            {
                NHibernateUnitOfWorkFactory nestedUnitOfWorkFactory = new NHibernateUnitOfWorkFactory(config.NHibernateConfigurationFile);
                nestedUnitOfWorkFactory.RegisterSessionFactory(CreateSessionFactory(config));
                unitOfWorkFactory.Add(nestedUnitOfWorkFactory);
            }
            Kernel.AddComponentInstance<IUnitOfWorkFactory>(unitOfWorkFactory);
        }
コード例 #2
0
        protected override void Init()
        {
            Kernel.Register(Component.For(typeof(IRepository<>)).ImplementedBy(typeof(NHRepository<>)));

            var unitOfWorkFactory = new MultipleNHibernateUnitOfWorkFactory();
            foreach (var config in configs)
            {
                var nestedUnitOfWorkFactory = new NHibernateUnitOfWorkFactory(config.NHibernateConfigurationFile);
                ((NHibernateUnitOfWorkFactory)nestedUnitOfWorkFactory).RegisterSessionFactory(CreateSessionFactory(config));
                unitOfWorkFactory.Add(((NHibernateUnitOfWorkFactory)nestedUnitOfWorkFactory));
            }
            Kernel.Register(Component.For<IUnitOfWorkFactory>().Instance(unitOfWorkFactory));
        }
コード例 #3
0
        protected override void Init()
        {
            Kernel.Register(Component.For(typeof(IRepository <>)).ImplementedBy(typeof(NHRepository <>)));

            var unitOfWorkFactory = new MultipleNHibernateUnitOfWorkFactory();

            foreach (var config in configs)
            {
                var nestedUnitOfWorkFactory = new NHibernateUnitOfWorkFactory(config.NHibernateConfigurationFile);
                ((NHibernateUnitOfWorkFactory)nestedUnitOfWorkFactory).RegisterSessionFactory(CreateSessionFactory(config));
                unitOfWorkFactory.Add(((NHibernateUnitOfWorkFactory)nestedUnitOfWorkFactory));
            }
            Kernel.Register(Component.For <IUnitOfWorkFactory>().Instance(unitOfWorkFactory));
        }
コード例 #4
0
        protected override void Init()
        {
            Kernel.Register(Component.For(typeof(IRepository <>)).ImplementedBy(typeof(NHRepository <>)));

            MultipleNHibernateUnitOfWorkFactory unitOfWorkFactory = new MultipleNHibernateUnitOfWorkFactory();

            foreach (NHibernateUnitOfWorkFacilityConfig config in configs)
            {
                NHibernateUnitOfWorkFactory nestedUnitOfWorkFactory = new NHibernateUnitOfWorkFactory(config.NHibernateConfigurationFile);
                nestedUnitOfWorkFactory.RegisterSessionFactory(CreateSessionFactory(config));
                unitOfWorkFactory.Add(nestedUnitOfWorkFactory);
            }
            Kernel.AddComponentInstance <IUnitOfWorkFactory>(unitOfWorkFactory);
        }