Skip to content

Async handler implementation

Compare
Choose a tag to compare
@dlebee dlebee released this 07 Dec 05:27

You can now use IQueryHandlerAsync to execute the query in await/async context πŸ‘

New Async

[HttpPost]
public async Task<IQueryExecutionResult> Read(
    [FromServices]YourContext context, 
    [FromServices]IQueryHandlerAsync handler,
    [FromBody]IQueryCriteria criteria)
{
    IQueryable<OfSomething> query = context.Somethings;
    var result = await handler.ExecuteAsync(query, criteria);
    return result;
}