示例#1
0
        /// <summary>
        /// 得到指定的数据库
        /// </summary>
        /// <param name="connString">数据库连接字符串</param>
        /// <param name="providerName">数据库提供者(sqlserver、mysql)</param>
        /// <returns></returns>
        public static IDBOperator GetDatabase(string connString, string providerName = "sqlserver")
        {
            IDBOperator db;

            switch (providerName.ToLower())
            {
            case "sqlserver":
                db = new SqlDBOperator(connString);
                break;

            default:
                db = new SqlDBOperator(connString);
                break;
            }
            return(db);
        }
示例#2
0
 /// <summary>
 /// 构造器,实现数据库连接
 /// </summary>
 public LogRepositoryADO()
 {
     _DB = new SqlDBOperator(ConfigHelper.AppSettingConfiguration["ConnectionStrings:DefaultConnection"]);
 }