public ISessionFactory CreateSessionFactory()
{
lock (locker)
{
var sessionFactory =
Configure.SessionFactories.SingleOrDefault(s => s.ConnectionName == this.chosenConnectionName);
if (sessionFactory == null)
{
if (this.log.IsDebug)
{
this.log.Debug(
LogMessages.FluentConfiguration_CreatingSessionFactory,
this.chosenConnectionName,
this.chosenDbDriver.GetType().Name,
this.chosenSqlDialect.GetType().Name);
}
sessionFactory = new SessionFactory(this.chosenConnectionName, this.chosenDbDriver, this.chosenSqlDialect);
if (this.sessionFactoryCreated != null)
{
sessionFactory = this.sessionFactoryCreated(sessionFactory);
}
Configure.SessionFactories.Add(sessionFactory);
}
return sessionFactory;
}
}