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); }
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)); }
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)); }
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); }