protected IDictionary <string, string> GetProperties() { MsSqlConfiguration config = MsSqlConfiguration.MsSql2005; config.ConnectionString.FromConnectionStringWithKey("MYDBKEY"); config.ShowSql(); config.UseOuterJoin(); return(config.ToProperties()); }
private static IPersistenceConfigurer MsSqlConfigureDatabase2008(NHConfigurationSection nhConfiguration) { MsSqlConfiguration cfg = MsSqlConfiguration.MsSql2008 .ConnectionString(c => c.FromConnectionStringWithKey(nhConfiguration.ConnectionStringName)) .UseOuterJoin() .DefaultSchema(nhConfiguration.DatabaseSchema); #if DEBUG cfg.ShowSql(); #endif return(cfg); }
protected SessionManager() { lock (_locker) { string logName = Configuration.Current.Log.Name; var sw = Stopwatch.StartNew(); SessionLog.AddLogMessage("### New session factory created at {0:yyyy-MM-dd HH:mm:ss}", DateTime.Now); SessionLog.AddLogMessage("IsProduction: {0}", IsProduction()); MsSqlConfiguration mssql = MsSqlConfiguration.MsSql2012.ConnectionString(cs => cs.FromConnectionStringWithKey("cnSselData")); if (ShowSql) { mssql.ShowSql(); SessionLog.AddLogMessage("ShowSql: true"); } else { SessionLog.AddLogMessage("ShowSql: false"); } var config = Fluently.Configure() .Database(mssql) .Mappings(HandleMappings) .CurrentSessionContext <T>(); //this determines what CurrentSessionContext will be _sessionFactory = config.BuildSessionFactory(); _factoryId = Guid.NewGuid(); sw.Stop(); SessionLog.AddLogMessage("FactoryID: {0}", _factoryId); SessionLog.AddLogMessage("### New session factory completed at {0:yyyy-MM-dd HH:mm:ss} ({1:#0.0000} seconds)", DateTime.Now, sw.Elapsed.TotalMilliseconds / 1000.0); SessionLog.WriteAll(logName, !IsProduction()); } }