From 23a99f85cac40470eadd3ea4c9e08a6ef686bc28 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Tue, 14 Nov 2023 20:34:32 -0800 Subject: [PATCH] Remove ConfigureAwait(false) --- src/YesSql.Abstractions/SessionExtensions.cs | 2 +- .../Services/DbBlockIdGenerator.cs | 6 ++--- .../Services/DefaultIdGenerator.cs | 2 +- src/YesSql.Core/Session.cs | 4 ++-- src/YesSql.Core/Sql/SchemaBuilder.cs | 22 +++++++++---------- src/YesSql.Core/Store.cs | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/YesSql.Abstractions/SessionExtensions.cs b/src/YesSql.Abstractions/SessionExtensions.cs index 02053329..bedc5665 100644 --- a/src/YesSql.Abstractions/SessionExtensions.cs +++ b/src/YesSql.Abstractions/SessionExtensions.cs @@ -73,7 +73,7 @@ public static ISession RegisterIndexes(this ISession session, IIndexProvider ind /// The name of the collection. [Obsolete($"Instead, utilize the {nameof(SaveAsync)} method. This current method is slated for removal in upcoming releases.")] public static void Save(this ISession session, object obj, string collection = null) - => session.SaveAsync(obj, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + => session.SaveAsync(obj, collection).GetAwaiter().GetResult(); public static Task SaveAsync(this ISession session, object obj, string collection = null) => session.SaveAsync(obj, false, collection); diff --git a/src/YesSql.Core/Services/DbBlockIdGenerator.cs b/src/YesSql.Core/Services/DbBlockIdGenerator.cs index afa4e159..8b95f7e1 100644 --- a/src/YesSql.Core/Services/DbBlockIdGenerator.cs +++ b/src/YesSql.Core/Services/DbBlockIdGenerator.cs @@ -53,9 +53,9 @@ public async Task InitializeAsync(IStore store) await using var connection = store.Configuration.ConnectionFactory.CreateConnection(); await connection.OpenAsync(); - + await using var transaction = await connection.BeginTransactionAsync(store.Configuration.IsolationLevel); - + try { var localBuilder = new SchemaBuilder(store.Configuration, transaction, true); @@ -74,7 +74,7 @@ await localBuilder.CreateTableAsync(TableName, table => table } public long GetNextId(string collection) - => GetNextIdAsync(collection).ConfigureAwait(false).GetAwaiter().GetResult(); + => GetNextIdAsync(collection).GetAwaiter().GetResult(); public async Task GetNextIdAsync(string collection) { diff --git a/src/YesSql.Core/Services/DefaultIdGenerator.cs b/src/YesSql.Core/Services/DefaultIdGenerator.cs index ead0539a..966bfbda 100644 --- a/src/YesSql.Core/Services/DefaultIdGenerator.cs +++ b/src/YesSql.Core/Services/DefaultIdGenerator.cs @@ -18,7 +18,7 @@ public class DefaultIdGenerator : IIdGenerator private ISqlDialect _dialect; public long GetNextId(string collection) - => GetNextIdAsync(collection).ConfigureAwait(false).GetAwaiter().GetResult(); + => GetNextIdAsync(collection).GetAwaiter().GetResult(); public async Task GetNextIdAsync(string collection) { diff --git a/src/YesSql.Core/Session.cs b/src/YesSql.Core/Session.cs index 6ec17585..44059c4f 100644 --- a/src/YesSql.Core/Session.cs +++ b/src/YesSql.Core/Session.cs @@ -83,7 +83,7 @@ private SessionState GetState(string collection) [Obsolete] public void Save(object entity, bool checkConcurrency = false, string collection = null) - => SaveAsync(entity, checkConcurrency, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + => SaveAsync(entity, checkConcurrency, collection).GetAwaiter().GetResult(); public async Task SaveAsync(object entity, bool checkConcurrency = false, string collection = null) { @@ -630,7 +630,7 @@ public void Dispose(bool disposing) { try { - CommitOrRollbackTransactionAsync().ConfigureAwait(false).GetAwaiter().GetResult(); + CommitOrRollbackTransactionAsync().GetAwaiter().GetResult(); } catch { diff --git a/src/YesSql.Core/Sql/SchemaBuilder.cs b/src/YesSql.Core/Sql/SchemaBuilder.cs index 48a3631c..8eb86da2 100644 --- a/src/YesSql.Core/Sql/SchemaBuilder.cs +++ b/src/YesSql.Core/Sql/SchemaBuilder.cs @@ -265,67 +265,67 @@ public async Task CreateSchemaAsync(string schema) public ISchemaBuilder AlterTable(string name, Action table) { - AlterTableAsync(name, table).ConfigureAwait(false).GetAwaiter().GetResult(); + AlterTableAsync(name, table).GetAwaiter().GetResult(); return this; } public ISchemaBuilder AlterIndexTable(Type indexType, Action table, string collection) { - AlterIndexTableAsync(indexType, table, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + AlterIndexTableAsync(indexType, table, collection).GetAwaiter().GetResult(); return this; } public ISchemaBuilder CreateForeignKey(string name, string srcTable, string[] srcColumns, string destTable, string[] destColumns) { - CreateForeignKeyAsync(name, srcTable, srcColumns, destTable, destColumns).ConfigureAwait(false).GetAwaiter().GetResult(); + CreateForeignKeyAsync(name, srcTable, srcColumns, destTable, destColumns).GetAwaiter().GetResult(); return this; } public ISchemaBuilder CreateMapIndexTable(Type indexType, Action table, string collection) { - CreateMapIndexTableAsync(indexType, table, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + CreateMapIndexTableAsync(indexType, table, collection).GetAwaiter().GetResult(); return this; } public ISchemaBuilder CreateReduceIndexTable(Type indexType, Action table, string collection) { - CreateReduceIndexTableAsync(indexType, table, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + CreateReduceIndexTableAsync(indexType, table, collection).GetAwaiter().GetResult(); return this; } public ISchemaBuilder CreateTable(string name, Action table) { - CreateTableAsync(name, table).ConfigureAwait(false).GetAwaiter().GetResult(); + CreateTableAsync(name, table).GetAwaiter().GetResult(); return this; } public ISchemaBuilder DropForeignKey(string srcTable, string name) { - DropForeignKeyAsync(srcTable, name).ConfigureAwait(false).GetAwaiter().GetResult(); + DropForeignKeyAsync(srcTable, name).GetAwaiter().GetResult(); return this; } public ISchemaBuilder DropMapIndexTable(Type indexType, string collection = null) { - DropMapIndexTableAsync(indexType, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + DropMapIndexTableAsync(indexType, collection).GetAwaiter().GetResult(); return this; } public ISchemaBuilder DropReduceIndexTable(Type indexType, string collection = null) { - DropReduceIndexTableAsync(indexType, collection).ConfigureAwait(false).GetAwaiter().GetResult(); + DropReduceIndexTableAsync(indexType, collection).GetAwaiter().GetResult(); return this; } public ISchemaBuilder DropTable(string name) { - DropTableAsync(name).ConfigureAwait(false).GetAwaiter().GetResult(); + DropTableAsync(name).GetAwaiter().GetResult(); return this; } public ISchemaBuilder CreateSchema(string schema) { - CreateSchemaAsync(schema).ConfigureAwait(false).GetAwaiter().GetResult(); + CreateSchemaAsync(schema).GetAwaiter().GetResult(); return this; } diff --git a/src/YesSql.Core/Store.cs b/src/YesSql.Core/Store.cs index 0239585a..b54376b5 100644 --- a/src/YesSql.Core/Store.cs +++ b/src/YesSql.Core/Store.cs @@ -261,7 +261,7 @@ private static Func MakeDescriptorActivator(Type type) [Obsolete($"Instead, utilize the {nameof(GetNextIdAsync)} method. This current method is slated for removal in upcoming releases.")] public long GetNextId(string collection) - => GetNextIdAsync(collection).ConfigureAwait(false).GetAwaiter().GetResult(); + => GetNextIdAsync(collection).GetAwaiter().GetResult(); public Task GetNextIdAsync(string collection) => Configuration.IdGenerator.GetNextIdAsync(collection);