Hi,
I have got a windows 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
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.