private DbManager GetDb(string dbid, string connectionString) { var connectionSettings = new System.Configuration.ConnectionStringSettings(dbid, connectionString, "MySql.Data.MySqlClient"); if (DbRegistry.IsDatabaseRegistered(connectionSettings.Name)) { DbRegistry.UnRegisterDatabase(connectionSettings.Name); } DbRegistry.RegisterDatabase(connectionSettings.Name, connectionSettings); return(DbOptions.Get(connectionSettings.Name)); }
private static DbManager GetDb(string dbid, string connectionString) { var connectionSettings = new ConnectionStringSettings(dbid, connectionString, "MySql.Data.MySqlClient"); if (DbRegistry.IsDatabaseRegistered(connectionSettings.Name)) { DbRegistry.UnRegisterDatabase(connectionSettings.Name); } DbRegistry.RegisterDatabase(connectionSettings.Name, connectionSettings); return(new DbManager(connectionSettings.Name)); }
protected string RegisterDatabase(int id, string connectionString) { connectionString = connectionString + ";convert zero datetime=True"; var connectionSettings = new ConnectionStringSettings("mailservice-" + id, connectionString, "MySql.Data.MySqlClient"); if (DbRegistry.IsDatabaseRegistered(connectionSettings.Name)) { DbRegistry.UnRegisterDatabase(connectionSettings.Name); } DbRegistry.RegisterDatabase(connectionSettings.Name, connectionSettings); return(connectionSettings.Name); }