Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save WiktorNowikow/977c03fdaafe7e379f008bedbcbabad5 to your computer and use it in GitHub Desktop.
Save WiktorNowikow/977c03fdaafe7e379f008bedbcbabad5 to your computer and use it in GitHub Desktop.
Generic request for MediatR
public class GetGlossaryListQuery<TEntity> :IRequest<IEnumerable>
where TEntity : BaseTableModel
{
public class GetGlossaryListQueryHandler : BaseEnsiHandler, IRequestHandler<GetGlossaryListQuery<TEntity>, IEnumerable>
{
public async Task<IEnumerable> Handle(GetGlossaryListQuery<TEntity> request, CancellationToken cancellationToken)
{
}
}
}
//dependency injection
services.AddTransient(typeof(IRequestHandler<,>), typeof(GetGlossaryListQuery<>.GetGlossaryListQueryHandler));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment