コード例 #1
0
        public string LoadConfig()
        {
            //"bin\\Debug\\netcoreapp2.2\\ConfigResource\\mysqlconfig.xml"
            string    configPath = AppSettingConfig.GetAppSetting()["AppSetting:mysqlconfigPath"];
            XDocument xDoc       = this.LocalConfig(configPath);
            var       sc         = from t in xDoc.Root.Elements("sqlconntionitem")
                                   select MySqlDbConnectionConfig.CreaterConfigureItem(t);

            var s = sc.First();

            return(sc.First().ToString());
        }
コード例 #2
0
 public static string GetSqlDbConntionConfigure()
 {
     lock (obj)
     {
         if (mySqlDbConnectionConfig == null)
         {
             mySqlDbConnectionConfig = new MySqlDbConnectionConfig();
             return(mySqlDbConnectionConfig.LoadConfig());
         }
         return(mySqlDbConnectionConfig.LoadConfig());
     }
 }
コード例 #3
0
        public IDbCommand GetIDbCommand()
        {
            MySqlCommand mySqlCommand = null;

            if (this._con == null)
            {
                this._con = this._con ?? new MySqlConnection(MySqlDbConnectionConfig.GetSqlDbConntionConfigure());
            }
            if (this._con.State == ConnectionState.Closed)
            {
                this._con.Open();
            }
            mySqlCommand = this._con.CreateCommand();
            return(mySqlCommand);
        }
コード例 #4
0
 public IDbConnection GetIDbConnection()
 {
     this._con = this._con ?? new MySqlConnection(MySqlDbConnectionConfig.GetSqlDbConntionConfigure());
     return(this._con);
 }