I have a static SessionFactory
class that initializes an NHibernate session factory. Because this process is expensive (~5 sec.), I want it to be static so it's only done once, at the beginning of runtime.
The configuration can take a database parameter parameter like so:
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 DbConfig with the correct constant?