예제 #1
0
        /// <summary>
        /// 返回数据库类型名称
        /// </summary>
        public static DbProvider CreateDbProvider <TEntity>(DataBaseType?db = null) where TEntity : class, new()
        {
            var dbType = db ?? CacheManger.GetTableMap(typeof(TEntity)).ClassInfo.DataType;

            switch (dbType)
            {
            case DataBaseType.OleDb: return(new OleDbProvider());

            case DataBaseType.MySql: return(new MySqlProvider());

            case DataBaseType.SQLite: return(new SqLiteProvider());

            case DataBaseType.Oracle: return(new OracleProvider());
            }
            return(new SqlServerProvider());
        }
예제 #2
0
        /// <summary>
        ///     压缩数据库
        /// </summary>
        /// <param name="dbIndex">数据库配置</param>
        public static void Compression(int dbIndex)
        {
            DbInfo dbInfo = dbIndex;

            Compression(CacheManger.CreateConnString(dbIndex), dbInfo.DataType);
        }