I'm trying to get the SessionFactory wired up for Repository<T> which
my other classes inherit from (but they don't expose a SessionFactory
property expect for the the inherited property in Repository<T>
ofcourse).
How do I wire this up using castle windsor.
public class Repository<T> : IRepository<T>
{
public ISessionFactory SessionFactory { get; set; }
public Repository() {}
}
My sessionfactory is already wired up using:
public void Install(IWindsorContainer container,
IConfigurationStore store)
{
container.Register(Component.For<ISessionFactory>()
.UsingFactoryMethod(k =>
BuildSessionFactory()));
container.Register(Component.For<NHibernateSessionModule>());
container.Register(Component.For<ISessionFactoryProvider>().AsFactory());
container.Register(Component.For<IEnumerable<ISessionFactory>>()
.UsingFactoryMethod(k =>
k.ResolveAll<ISessionFactory>()));
HttpContext.Current.Application[SessionFactoryProvider.Key]
=
container.Resolve<ISessionFactoryProvider>();
}
My setup is based on:
http://nhforge.org/blogs/nhibernate/archive/2011/03/03/effective-nhibernate-session-management-for-web-apps.aspx
--
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.