Register Multiple Components for Single Interface Using Castle Windsor
问题 I am trying to register multiple NHibernate ISessions (multiple databases) by using the code below. I am getting "There is a component already registered for the given key Castle.MicroKernel.Registration.GenericFactory`1[[NHibernate.ISession, NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4]]" as the error message when the container is trying to be built. container.Kernel.Register( Component.For<ISession>().LifeStyle.Transient .UsingFactoryMethod(() =>