Skip to content

Commit

Permalink
prefer ReadAsync()
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiogenesis committed Jul 7, 2024
1 parent 63d56ef commit 75fb49d
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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().ConfigureAwait(false))
{
dataReader.Close();
command.Dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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().ConfigureAwait(false))
{
// Create a row from dataReader
var syncRow = CreateSyncRowFromReader(context, dataReader, schemaChangesTable);
Expand Down Expand Up @@ -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().ConfigureAwait(false))
{
bool isTombstone = false;
for (var i = 0; i < dataReader.FieldCount; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfoClien

ScopeInfoClient scopeInfoClient = null;

if (reader.Read())
if (await reader.ReadAsync().ConfigureAwait(false))
scopeInfoClient = InternalReadScopeInfoClient(reader);

reader.Close();
Expand Down Expand Up @@ -209,7 +209,7 @@ internal virtual async Task<List<ScopeInfoClient>> InternalLoadAllScopeInfoClien

using DbDataReader reader = await command.ExecuteReaderAsync().ConfigureAwait(false);

while (reader.Read())
while (await reader.ReadAsync().ConfigureAwait(false))
{
var scopeInfoClient = InternalReadScopeInfoClient(reader);

Expand Down Expand Up @@ -264,7 +264,7 @@ internal virtual async Task<List<ScopeInfoClient>> InternalLoadAllScopeInfoClien

using DbDataReader reader = await command.ExecuteReaderAsync().ConfigureAwait(false);

reader.Read();
await reader.ReadAsync().ConfigureAwait(false);

var newScopeInfoClient = InternalReadScopeInfoClient(reader);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfo,

ScopeInfo scopeInfo = null;

if (reader.Read())
if (await reader.ReadAsync().ConfigureAwait(false))
scopeInfo = InternalReadScopeInfo(reader);

reader.Close();
Expand Down Expand Up @@ -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().ConfigureAwait(false))
{
var scopeInfo = InternalReadScopeInfo(reader);

Expand Down Expand Up @@ -348,7 +348,7 @@ await this.InternalCreateScopeInfoTableAsync(context, DbScopeType.ScopeInfo,

using DbDataReader reader = await action.Command.ExecuteReaderAsync().ConfigureAwait(false);

reader.Read();
await reader.ReadAsync().ConfigureAwait(false);

scopeInfo = InternalReadScopeInfo(reader);

Expand Down
4 changes: 2 additions & 2 deletions Projects/Dotmim.Sync.MySql/MySqlManagementUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static class MySqlManagementUtils
{
if (reader.HasRows)
{
reader.Read();
await reader.ReadAsync().ConfigureAwait(false);
dbName = reader.GetString(0);
dbVersion = reader.GetString(1);
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public static async Task<SyncSetup> GetAllTablesAsync(MySqlConnection connection

using (var reader = await mySqlCommand.ExecuteReaderAsync().ConfigureAwait(false))
{
while (reader.Read())
while (await reader.ReadAsync().ConfigureAwait(false))
{
var tableName = reader.GetString(0);
var setupTable = new SetupTable(tableName);
Expand Down
4 changes: 2 additions & 2 deletions Projects/Dotmim.Sync.PostgreSql/NpgsqlManagementUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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().ConfigureAwait(false))
{
var tableName = reader.GetString(0);
var schemaName = reader.GetString(1);
Expand Down Expand Up @@ -305,7 +305,7 @@ from information_schema.columns
{
if (reader.HasRows)
{
reader.Read();
await reader.ReadAsync().ConfigureAwait(false);

dbVersion = reader.GetString(0);
dbName = reader.GetString(1);
Expand Down
4 changes: 2 additions & 2 deletions Projects/Dotmim.Sync.SqlServer/SqlManagementUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static async Task<SyncSetup> GetAllTablesAsync(SqlConnection connection,

using (var reader = await sqlCommand.ExecuteReaderAsync().ConfigureAwait(false))
{
while (reader.Read())
while (await reader.ReadAsync().ConfigureAwait(false))
{
var tableName = reader.GetString(0);
var schemaName = reader.GetString(1) == "dbo" ? null : reader.GetString(1);
Expand Down Expand Up @@ -546,7 +546,7 @@ public static async Task<bool> IsChangeTrackingEnabledAsync(SqlConnection connec
{
if (reader.HasRows)
{
reader.Read();
await reader.ReadAsync().ConfigureAwait(false);

dbName = reader.GetString(0);
dbVersion = reader.GetString(1);
Expand Down
2 changes: 1 addition & 1 deletion Projects/Dotmim.Sync.SqlServer/SqlSyncAdapter.Batch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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().ConfigureAwait(false))
{
var failedRow = new SyncRow(schemaChangesTable, syncRowState);

Expand Down
2 changes: 1 addition & 1 deletion Projects/Dotmim.Sync.Sqlite/SQLiteManagementUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static async Task<SyncSetup> GetAllTablesAsync(SqliteConnection connectio

using (var reader = await sqlCommand.ExecuteReaderAsync().ConfigureAwait(false))
{
while (reader.Read())
while (await reader.ReadAsync().ConfigureAwait(false))
{
var tableName = reader.GetString(0);
var setupTable = new SetupTable(tableName);
Expand Down

0 comments on commit 75fb49d

Please sign in to comment.