We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7a9f29 commit 59d5401Copy full SHA for 59d5401
test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/DatabaseFixture.cs
@@ -46,14 +46,11 @@ public void Dispose()
46
47
public static void DropTable(string tableName = null)
48
{
49
- try
+ using (var conn = new SqlConnection(LogEventsConnectionString))
50
51
- using (var conn = new SqlConnection(LogEventsConnectionString))
52
- {
53
- conn.Execute($"DROP TABLE {(string.IsNullOrEmpty(tableName) ? LogTableName : tableName)};");
54
- }
+ var actualTableName = string.IsNullOrEmpty(tableName) ? LogTableName : tableName;
+ conn.Execute($"IF OBJECT_ID('{actualTableName}', 'U') IS NOT NULL DROP TABLE {actualTableName};");
55
}
56
- catch { }
57
58
59
private static void DeleteDatabase()
0 commit comments