コード例 #1
0
        /// <summary>
        /// 添加数据库配置信息
        /// </summary>
        /// <param name="key">配置信息key键</param>
        /// <param name="action"></param>
        public void Add(string key, Action <SqlConnectionModel> action)
        {
            var model = new SqlConnectionModel();

            action(model);
            ConfigMapping[key] = model;
        }
コード例 #2
0
        public virtual string ConvertDictionaryToString()
        {
            SqlConnectionModel model = new SqlConnectionModel
            {
                Properties = reader.GetConnectionString(FileAddress)
            };
            string dbConnectionString = String.Format(@"Data Source={0}; Initial Catalog={1}; Persist Security Info=True; MultipleActiveResultSets=True; User ID={2}; Password={3}; Pooling = true; Max Pool Size = 200; ConnectRetryCount=2; Asynchronous Processing=true; Async = true",
                                                      model.Properties["server"], model.Properties["db"], model.Properties["login"], model.Properties["password"]);

            return(dbConnectionString);
        }
コード例 #3
0
        public virtual string ConvertDictionaryToString()
        {
            SqlConnectionModel model = new SqlConnectionModel
            {
                Properties = reader.GetConnectionString(FileAddress)
            };
            string dbConnectionString = String.Format(@"Server={0}; Database={1}; Convert Zero Datetime=True; Uid={2}; Pwd={3}; charset=utf8",
                                                      model.Properties["server"], model.Properties["db"], model.Properties["login"], model.Properties["password"]);

            return(dbConnectionString);
        }
コード例 #4
0
 public static string GetConnectionString(SqlConnectionModel model)
 {
     return(ActionMapping[model.Type](model));
 }