Skip to content

Commit 9470f22

Browse files
committed
added “using” to ensure that resources are released
1 parent fa0f53c commit 9470f22

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/FirebirdSql.Data.FirebirdClient.Tests/FbDatabaseInfoTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,15 @@ IDictionary<short, ulong> GetAffectedTables(IDictionary<short, ulong> statisticI
170170
async Task<IDictionary<string, short>> GetTableNameList()
171171
{
172172
IDictionary<string, short> result = new Dictionary<string, short>();
173-
var command = new FbCommand("select R.RDB$RELATION_ID, R.RDB$RELATION_NAME from RDB$RELATIONS R WHERE RDB$SYSTEM_FLAG = 0", Connection);
174-
var reader = await command.ExecuteReaderAsync();
175-
while (await reader.ReadAsync())
173+
await using (var command = new FbCommand("select R.RDB$RELATION_ID, R.RDB$RELATION_NAME from RDB$RELATIONS R WHERE RDB$SYSTEM_FLAG = 0", Connection))
176174
{
177-
result.Add(reader.GetString(1).Trim(), reader.GetInt16(0));
175+
await using (var reader = await command.ExecuteReaderAsync())
176+
{
177+
while (await reader.ReadAsync())
178+
{
179+
result.Add(reader.GetString(1).Trim(), reader.GetInt16(0));
180+
}
181+
}
178182
}
179183
return result;
180184
}

0 commit comments

Comments
 (0)