I'm new to Castle and have been trying to convert an application over to
Castle from Spring.NET/NHibernate using FluentNHibernate. I'm working using
the sample ToBeSeen project as a reference and have done okay up until I hit
this problem:
My application uses two databases. With Spring.NET/NHibernate I created two
instances of ISessionFactory and gave them unique names. When injecting an
ISessionFactory into an object, I specified the name. How do I do this with
Castle? Assuming I have this:
Kernel.Register(
Component.For<ISessionFactory>()
.UsingFactoryMethod(config1.BuildSessionFactory)
.Named("sessionManager1"));
Kernel.Register(
Component.For<ISessionFactory>()
.UsingFactoryMethod(config2.BuildSessionFactory)
.Named("sessionManager2"));
and a UserRepository mapping:
container.Register(Component.For<IUserRepository>()
.ImplementedBy<UserRepository>()
.LifeStyle.Transient);
container.Register(Component.For<ICompanyRepository>()
.ImplementedBy<CompanyRepository>()
.LifeStyle.Transient);
How do I inject "sessionManager1" into UserRepository and "sessionManager2"
into CompanyRepository?
Thanks,
Dave.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
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.