I have a static class SessionFactorythat initializes an NHibernate factory session. Since this process is expensive (~ 5 seconds), I want it to be static, so it only runs once at the start of execution.
The configuration can accept a database parameter parameter as follows:
public static IPersistenceConfigurer DbConfig { get; set; }
public static void Initialize()
{
var cfg = Fluently.Configure()
.Database(DbConfig)
.Mappings(some mappings)
.BuildConfiguration();
}
Is it possible to use Ninject to inject a DbConfig with the correct constant?
source
share