This might help: https://github.com/haf/Castle.Facilities.NHibernate/blob/master/src/Castle.Facilities.NHibernate/NHibernateFacility.cs#L257
On Tuesday, August 14, 2012 8:33:06 PM UTC+2, Mike wrote: > > Hi, > > I have got a windpows service which looks for a certain file and save it > to the DB. I'm using the repository pattern and using Castle Windsor for DI. > > This is how I register the NHibernate ISession and my unit of work. > > container.Register( > Component.For<ISession>().UsingFactoryMethod(() => > NHibernateSessionManager.Instance.GetSession()).LifeStyle.Transient); > > container.Register( > > Component.For<INHibernateSessionManager>().Instance(NHibernateSessionManager.Instance).LifestyleSingleton()); > > container.Register( > > Component.For<IUnitOfWork<ISession>>().ImplementedBy<Data.Framework.Nhibernate.UnitOfWork.NHibernateUnitOfWork>().LifeStyle.Transient); > > > container.Register(Component.For(typeof(IRepository<>)).ImplementedBy(typeof(NHibernateRepository<>)).LifeStyle.Transient); > > This does not work for me, as when it tried to resolve the repository it's > complaining about a key added to the repository already. > > Can you please tell me how to do this properly? > > Thanks, -Mike > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/gydGngWce1AJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
