public static void SetConfigure(DatabaseSetting confg) { try { DatabaseContext context = new DatabaseContext(confg); if (confg.DBType == DBType.SQLServer) { context.SessionFactory = Fluently.Configure().Database(MsSqlConfiguration.MsSql2008.ConnectionString(confg.ConnectionString)) .Mappings(m => { if (confg.Types.Count > 0) { foreach (Type item in confg.Types) { m.FluentMappings.Add(item); } } }).BuildSessionFactory(); sesionFactories.Add(confg.Name, context); } else if (confg.DBType == DBType.Oracle) { context.SessionFactory = Fluently.Configure().Database(OracleDataClientConfiguration.Oracle10.ConnectionString(confg.ConnectionString)) .Mappings(m => { if (confg.Types.Count > 0) { foreach (Type item in confg.Types) { m.FluentMappings.Add(item); } } }).BuildSessionFactory(); sesionFactories.Add(confg.Name, context); } if (!dconnectionStrings.ContainsKey(confg.GetConnectionStringWithOutPassword())) { dconnectionStrings.Add(confg.GetConnectionStringWithOutPassword(), confg.ConnectionString); } } catch (Exception e) { throw new BusinessException(e).GetFaultException(); } }