public static IEnumerable <IQueryHandlerWrapper <TQuery, TResult> > GetQueryHandlerWrappers <TQuery, TResult>(this IHandlerRegistry handlerRegistry) where TQuery : IQuery <TResult> => handlerRegistry.GetQueryHandlerWrappers(typeof(TQuery), typeof(TResult)).Cast <IQueryHandlerWrapper <TQuery, TResult> >();
public ReflectedQueryHandlerWrappers(Type queryType, IHandlerRegistry handlerRegistry) { wrappers = handlerRegistry.GetQueryHandlerWrappers(queryType, typeof(TResult)); handleMethod = typeof(IQueryHandlerWrapper <,>).MakeGenericType(queryType, typeof(TResult)) .GetMethod(nameof(IQueryHandlerWrapper <IQuery <TResult>, TResult> .HandleAsync), BindingFlags.Public | BindingFlags.Instance); }