예제 #1
0
        static DataConfig()
        {
            StreamReader reader = new StreamReader(Path.Combine(baseDir, configPath));
            ConfigModel  model  = JsonConvert.DeserializeObject <ConfigModel>(reader.ReadToEnd());

            SQLConfig   = model.SQLServerConfig;
            MySQLConfig = model.MySQLServerConfig;
        }
        public static MySqlConnection CreateMySQLDatabaseContext(string database)
        {
            if (string.IsNullOrWhiteSpace(database))
            {
                throw new ArgumentNullException("database");
            }

            MySQLConfig     config     = DataConfig.MySQLConfig;
            MySqlConnection connection = new MySqlConnection(string.Format(DataConfig.MySQLConfig.MysqlConnectionUrl, config.Server, config.Port, config.UserId, config.Password, database));

            return(connection);
        }
예제 #3
0
 public ConfigModel(SQLConfig SQLServerConfig, MySQLConfig MySQLServerConfig)
 {
     this.SQLServerConfig   = SQLServerConfig;
     this.MySQLServerConfig = MySQLServerConfig;
 }