Skip to content

Commit

Permalink
Remove ConfigureAwait(false) (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Nov 15, 2023
1 parent 5dfa15e commit 3b1d745
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/YesSql.Abstractions/SessionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static ISession RegisterIndexes(this ISession session, IIndexProvider ind
/// <param name="collection">The name of the collection.</param>
[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);
Expand Down
6 changes: 3 additions & 3 deletions src/YesSql.Core/Services/DbBlockIdGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<long> GetNextIdAsync(string collection)
{
Expand Down
2 changes: 1 addition & 1 deletion src/YesSql.Core/Services/DefaultIdGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<long> GetNextIdAsync(string collection)
{
Expand Down
4 changes: 2 additions & 2 deletions src/YesSql.Core/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -630,7 +630,7 @@ public void Dispose(bool disposing)
{
try
{
CommitOrRollbackTransactionAsync().ConfigureAwait(false).GetAwaiter().GetResult();
CommitOrRollbackTransactionAsync().GetAwaiter().GetResult();
}
catch
{
Expand Down
22 changes: 11 additions & 11 deletions src/YesSql.Core/Sql/SchemaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,67 +265,67 @@ public async Task CreateSchemaAsync(string schema)

public ISchemaBuilder AlterTable(string name, Action<IAlterTableCommand> table)
{
AlterTableAsync(name, table).ConfigureAwait(false).GetAwaiter().GetResult();
AlterTableAsync(name, table).GetAwaiter().GetResult();
return this;
}

public ISchemaBuilder AlterIndexTable(Type indexType, Action<IAlterTableCommand> 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<ICreateTableCommand> 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<ICreateTableCommand> 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<ICreateTableCommand> 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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/YesSql.Core/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private static Func<IDescriptor> 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<long> GetNextIdAsync(string collection)
=> Configuration.IdGenerator.GetNextIdAsync(collection);
Expand Down

0 comments on commit 3b1d745

Please sign in to comment.