using PoweredSoft.CQRS.DynamicQuery; using PoweredSoft.CQRS.DynamicQuery.Abstractions; using PoweredSoft.CQRS.GraphQL.DynamicQuery; using System.Threading; using System.Threading.Tasks; namespace PoweredSoft.CQRS.GraphQL.HotChocolate.DynamicQuery { public class DynamicQueryRunnerWithParams where TSource : class where TDestination : class where TParams : class { private readonly DynamicQueryHandler handler; public DynamicQueryRunnerWithParams(DynamicQueryHandler handler) { this.handler = handler; } public async Task> RunAsync(IDynamicQuery query, CancellationToken cancellationToken = default) { var result = await handler.HandleAsync(query); var outcome = new GraphQLDynamicQueryExecutionResult(); outcome.FromResult(result); return outcome; } } }