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

-- 
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/-/3T0TAXq0MJ0J.
To post to this group, send email to castle-project-users@googlegroups.com.
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to