/// <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()); }
/// <summary> /// 压缩数据库 /// </summary> /// <param name="dbIndex">数据库配置</param> public static void Compression(int dbIndex) { DbInfo dbInfo = dbIndex; Compression(CacheManger.CreateConnString(dbIndex), dbInfo.DataType); }