using Microsoft.AspNet.OData; using Microsoft.AspNetCore.Mvc; using PoweredSoft.CQRS.Abstractions; using PoweredSoft.CQRS.AspNetCore.Mvc; using System; using System.Threading.Tasks; namespace PoweredSoft.CQRS.AspNetCore.OData { [Route("api/odata/[controller]")] [ApiExplorerSettings(IgnoreApi = true)] public class QueryODataController : ODataController where TQuery : class { [EnableQuery, HttpGet, QueryControllerAuthorization] public async Task Get([FromServices]IQueryHandler queryHandler, [FromQuery]TQuery query) { var result = await queryHandler.HandleAsync(query, HttpContext.RequestAborted); return result; } } }