private static void CheckIfAuditTableExists(Type auditRecordType, DatabaseType databaseType) { var classConfig = ClassConfigContainer.FindClassConfig(auditRecordType); var table = classConfig.TableName; var sql = string.Empty; if (databaseType != DatabaseType.Oracle) { sql = string.Format("SELECT COUNT(*) " + "FROM INFORMATION_SCHEMA.TABLES " + "WHERE TABLE_SCHEMA = '[Schema]' AND TABLE_NAME = '{0}' OR TABLE_NAME = '{1}' ", table.ToLower(), table); } else { sql = string.Format("SELECT COUNT(*) FROM ALL_TABLES WHERE OWNER ='[Schema]' AND TABLE_NAME ='{0}'", table); } var database = DatabaseCreator.CreateDatabase(); var result = database.ExecuteScalar(sql); if (result.ToString() == "0") { throw new EasylinkException("Audit table {0} does not exist in the database.", table); } }
public static IDatabase Create() { if (DatabaseSetup.Instance == null) { InitializeDatabaseFactory(); } return(DatabaseCreator.CreateDatabase()); }