/// <summary> /// 根据Provider字符串获取数据类型 /// </summary> /// <param name="provider"></param> /// <returns></returns> public static DatabaseType GetDatabaseType(string provider) { DatabaseType dbType = DatabaseType.None; provider = provider.ToLower(); if (provider == SQLServer.ToLower() || provider == SQLAzure.ToLower()) { dbType = DatabaseType.SqlServer; } else if (provider == SqlServerCe.ToLower() || provider == SqlServerCe40.ToLower()) { dbType = DatabaseType.SqlCe; } else if (provider == SQLite.ToLower()) { dbType = DatabaseType.SQLite; } else if (provider == MySql.ToLower()) { dbType = DatabaseType.MySql; } else if (provider == Oracle.ToLower()) { dbType = DatabaseType.Oracle; } else if (provider == OracleDataAccess.ToLower()) { dbType = DatabaseType.Oracle; } else if (provider == OracleManagedDataAccess.ToLower()) { dbType = DatabaseType.Oracle; } else if (provider == Access.ToLower()) { dbType = DatabaseType.Access; } else if (provider == OleDb.ToLower()) { dbType = DatabaseType.OleDb; } else if (provider == Odbc.ToLower()) { dbType = DatabaseType.OleDb; } else if (provider == PostgreSQL.ToLower()) { dbType = DatabaseType.PostgreSQL; } else if (provider == DB2.ToLower()) { dbType = DatabaseType.DB2; } else if (provider == FirebirdSql.ToLower()) { dbType = DatabaseType.Firebird; } else if (provider == SybaseASA.ToLower()) { dbType = DatabaseType.SybaseASA; } else if (provider == SybaseASE.ToLower()) { dbType = DatabaseType.SybaseASE; } else if (provider == SybaseUltraLite.ToLower()) { dbType = DatabaseType.SybaseUltraLite; } else if (provider == DM.ToLower()) { dbType = DatabaseType.DM; } return(dbType); }