Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer ReadAsync() #1213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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