Injecting ISession Into My Repositories Using Structuremap in a Asp.Net MVC Application
My repositories all take ISession in the constructor: protected Repository(ISession session) { this.session = session; } private readonly ISession session; In an Asp.Net MVC application, using StructureMap, how would I go about setting up ISession in my the StructureMap Registry? Would I need to to add SessionFactory to the container also? Does FluentNHibernate change things? Dmytrii Nagirniak You should register ISession using a factory method. Another options (not always the best, but easy to use) is to: Implement ISession and ISessionFactory interfaces (SessionProxy and SessionFactoryProxy)