Skip to content

Commit b1d11e2

Browse files
committed
Fix IDE0079: Remove unnecessary suppression
1 parent 435b998 commit b1d11e2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

test/DapperTests/IntegrationTests/DapperTestContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ public async Task ClearAllTablesAsync(DbContext dbContext)
122122
_ => throw new NotSupportedException($"Unsupported database provider '{databaseProvider}'.")
123123
};
124124

125+
#if !NET6_0
125126
#pragma warning disable EF1002 // Risk of vulnerability to SQL injection.
127+
#endif
126128
// Justification: Table names cannot be parameterized.
127129
await dbContext.Database.ExecuteSqlRawAsync($"DELETE FROM {escapedTableName}");
130+
#if !NET6_0
128131
#pragma warning restore EF1002 // Risk of vulnerability to SQL injection.
132+
#endif
129133
}
130134
}
131135
}

test/TestBuildingBlocks/DbContextExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ private static async Task ClearTablesAsync(this DbContext dbContext, params Type
4444
}
4545
else
4646
{
47+
#if !NET6_0
4748
#pragma warning disable EF1002 // Risk of vulnerability to SQL injection.
49+
#endif
4850
// Justification: Table names cannot be parameterized.
4951
await dbContext.Database.ExecuteSqlRawAsync($"DELETE FROM \"{tableName}\"");
52+
#if !NET6_0
5053
#pragma warning restore EF1002 // Risk of vulnerability to SQL injection.
54+
#endif
5155
}
5256
}
5357
}

0 commit comments

Comments
 (0)