From ce0a12b9b7031415bc188f6bc1d1d6b4f74f9b91 Mon Sep 17 00:00:00 2001 From: Edward Miller Date: Sat, 6 Jul 2024 20:30:24 -0500 Subject: [PATCH] prefer ReadAsync() --- .../Orchestrators/BaseOrchestrator.Conflicts.cs | 2 +- .../Orchestrators/GetChanges/BaseOrchestrator.GetChanges.cs | 4 ++-- .../Scopes/BaseOrchestrator.ScopeInfoClients.cs | 6 +++--- .../Orchestrators/Scopes/BaseOrchestrator.ScopeInfos.cs | 6 +++--- Projects/Dotmim.Sync.MySql/MySqlManagementUtils.cs | 4 ++-- Projects/Dotmim.Sync.PostgreSql/NpgsqlManagementUtils.cs | 4 ++-- Projects/Dotmim.Sync.SqlServer/SqlManagementUtils.cs | 4 ++-- Projects/Dotmim.Sync.SqlServer/SqlSyncAdapter.Batch.cs | 2 +- Projects/Dotmim.Sync.Sqlite/SQLiteManagementUtils.cs | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Projects/Dotmim.Sync.Core/Orchestrators/BaseOrchestrator.Conflicts.cs b/Projects/Dotmim.Sync.Core/Orchestrators/BaseOrchestrator.Conflicts.cs index b0e911de1..40aab12ad 100644 --- a/Projects/Dotmim.Sync.Core/Orchestrators/BaseOrchestrator.Conflicts.cs +++ b/Projects/Dotmim.Sync.Core/Orchestrators/BaseOrchestrator.Conflicts.cs @@ -259,7 +259,7 @@ internal SyncConflict InternalGetConflict(SyncContext context, SyncRow remoteCon using var dataReader = await command.ExecuteReaderAsync().ConfigureAwait(false); - if (!dataReader.Read()) + if (!await dataReader.ReadAsync()) { dataReader.Close(); command.Dispose(); diff --git a/Projects/Dotmim.Sync.Core/Orchestrators/GetChanges/BaseOrchestrator.GetChanges.cs b/Projects/Dotmim.Sync.Core/Orchestrators/GetChanges/BaseOrchestrator.GetChanges.cs index 669a802fb..c1d5500b2 100644 --- a/Projects/Dotmim.Sync.Core/Orchestrators/GetChanges/BaseOrchestrator.GetChanges.cs +++ b/Projects/Dotmim.Sync.Core/Orchestrators/GetChanges/BaseOrchestrator.GetChanges.cs @@ -220,7 +220,7 @@ await schemaTables.ForEachAsync(async syncTable => // Get the reader using var dataReader = await args.Command.ExecuteReaderAsync().ConfigureAwait(false); - while (dataReader.Read()) + while (await dataReader.ReadAsync()) { // Create a row from dataReader var syncRow = CreateSyncRowFromReader(context, dataReader, schemaChangesTable); @@ -438,7 +438,7 @@ await scopeInfo.Schema.Tables.ForEachAsync(async syncTable => // Get the reader using var dataReader = await args.Command.ExecuteReaderAsync().ConfigureAwait(false); - while (dataReader.Read()) + while (await dataReader.ReadAsync()) { bool isTombstone = false; for (var i = 0; i < dataReader.FieldCount; i++) diff --git a/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfoClients.cs b/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfoClients.cs index 4690985bc..d7604a3a1 100644 --- a/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfoClients.cs +++ b/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfoClients.cs @@ -171,7 +171,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfoClien ScopeInfoClient scopeInfoClient = null; - if (reader.Read()) + if (await reader.ReadAsync()) scopeInfoClient = InternalReadScopeInfoClient(reader); reader.Close(); @@ -209,7 +209,7 @@ internal virtual async Task> InternalLoadAllScopeInfoClien using DbDataReader reader = await command.ExecuteReaderAsync().ConfigureAwait(false); - while (reader.Read()) + while (await reader.ReadAsync()) { var scopeInfoClient = InternalReadScopeInfoClient(reader); @@ -264,7 +264,7 @@ internal virtual async Task> InternalLoadAllScopeInfoClien using DbDataReader reader = await command.ExecuteReaderAsync().ConfigureAwait(false); - reader.Read(); + await reader.ReadAsync(); var newScopeInfoClient = InternalReadScopeInfoClient(reader); diff --git a/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfos.cs b/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfos.cs index cc4890eca..4e300a650 100644 --- a/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfos.cs +++ b/Projects/Dotmim.Sync.Core/Orchestrators/Scopes/BaseOrchestrator.ScopeInfos.cs @@ -206,7 +206,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfo, ScopeInfo scopeInfo = null; - if (reader.Read()) + if (await reader.ReadAsync()) scopeInfo = InternalReadScopeInfo(reader); reader.Close(); @@ -289,7 +289,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfo, using DbDataReader reader = await command.ExecuteReaderAsync().ConfigureAwait(false); - while (reader.Read()) + while (await reader.ReadAsync()) { var scopeInfo = InternalReadScopeInfo(reader); @@ -348,7 +348,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfo, using DbDataReader reader = await action.Command.ExecuteReaderAsync().ConfigureAwait(false); - reader.Read(); + await reader.ReadAsync(); scopeInfo = InternalReadScopeInfo(reader); diff --git a/Projects/Dotmim.Sync.MySql/MySqlManagementUtils.cs b/Projects/Dotmim.Sync.MySql/MySqlManagementUtils.cs index 164b754fc..1584bfdbb 100644 --- a/Projects/Dotmim.Sync.MySql/MySqlManagementUtils.cs +++ b/Projects/Dotmim.Sync.MySql/MySqlManagementUtils.cs @@ -56,7 +56,7 @@ public static class MySqlManagementUtils { if (reader.HasRows) { - reader.Read(); + await reader.ReadAsync(); dbName = reader.GetString(0); dbVersion = reader.GetString(1); } @@ -88,7 +88,7 @@ public static async Task GetAllTablesAsync(MySqlConnection connection using (var reader = await mySqlCommand.ExecuteReaderAsync().ConfigureAwait(false)) { - while (reader.Read()) + while (await reader.ReadAsync()) { var tableName = reader.GetString(0); var setupTable = new SetupTable(tableName); diff --git a/Projects/Dotmim.Sync.PostgreSql/NpgsqlManagementUtils.cs b/Projects/Dotmim.Sync.PostgreSql/NpgsqlManagementUtils.cs index ba77e68d7..6259e5b2a 100644 --- a/Projects/Dotmim.Sync.PostgreSql/NpgsqlManagementUtils.cs +++ b/Projects/Dotmim.Sync.PostgreSql/NpgsqlManagementUtils.cs @@ -190,7 +190,7 @@ where lower(table_type) = 'base table' using (var reader = await NpgsqlCommand.ExecuteReaderAsync().ConfigureAwait(false)) { - while (reader.Read()) + while (await reader.ReadAsync()) { var tableName = reader.GetString(0); var schemaName = reader.GetString(1); @@ -305,7 +305,7 @@ from information_schema.columns { if (reader.HasRows) { - reader.Read(); + await reader.ReadAsync(); dbVersion = reader.GetString(0); dbName = reader.GetString(1); diff --git a/Projects/Dotmim.Sync.SqlServer/SqlManagementUtils.cs b/Projects/Dotmim.Sync.SqlServer/SqlManagementUtils.cs index 2ff94f785..d8bcf8b80 100644 --- a/Projects/Dotmim.Sync.SqlServer/SqlManagementUtils.cs +++ b/Projects/Dotmim.Sync.SqlServer/SqlManagementUtils.cs @@ -39,7 +39,7 @@ public static async Task GetAllTablesAsync(SqlConnection connection, using (var reader = await sqlCommand.ExecuteReaderAsync().ConfigureAwait(false)) { - while (reader.Read()) + while (await reader.ReadAsync()) { var tableName = reader.GetString(0); var schemaName = reader.GetString(1) == "dbo" ? null : reader.GetString(1); @@ -546,7 +546,7 @@ public static async Task IsChangeTrackingEnabledAsync(SqlConnection connec { if (reader.HasRows) { - reader.Read(); + await reader.ReadAsync(); dbName = reader.GetString(0); dbVersion = reader.GetString(1); diff --git a/Projects/Dotmim.Sync.SqlServer/SqlSyncAdapter.Batch.cs b/Projects/Dotmim.Sync.SqlServer/SqlSyncAdapter.Batch.cs index 61646b44f..a0953f843 100644 --- a/Projects/Dotmim.Sync.SqlServer/SqlSyncAdapter.Batch.cs +++ b/Projects/Dotmim.Sync.SqlServer/SqlSyncAdapter.Batch.cs @@ -92,7 +92,7 @@ public override async Task ExecuteBatchCommandAsync(SyncContext context, DbComma using var dataReader = await cmd.ExecuteReaderAsync().ConfigureAwait(false); - while (dataReader.Read()) + while (await dataReader.ReadAsync()) { var failedRow = new SyncRow(schemaChangesTable, syncRowState); diff --git a/Projects/Dotmim.Sync.Sqlite/SQLiteManagementUtils.cs b/Projects/Dotmim.Sync.Sqlite/SQLiteManagementUtils.cs index 11bd7ffc2..f5550d4f1 100644 --- a/Projects/Dotmim.Sync.Sqlite/SQLiteManagementUtils.cs +++ b/Projects/Dotmim.Sync.Sqlite/SQLiteManagementUtils.cs @@ -34,7 +34,7 @@ public static async Task GetAllTablesAsync(SqliteConnection connectio using (var reader = await sqlCommand.ExecuteReaderAsync().ConfigureAwait(false)) { - while (reader.Read()) + while (await reader.ReadAsync()) { var tableName = reader.GetString(0); var setupTable = new SetupTable(tableName);