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(() => sessionFactoryOne.OpenSession()
).Named("ISession+sessionOne"));
container.Kernel.Register(
Component.For<ISession>().LifeStyle.Transient
.UsingFactoryMethod(() => sessionFactoryTwo.OpenSession())
.Named("ISession+sessionTwo"));