Hi. I have a generic mediatr request handler which looks like this:
public class GetOneByIdHandler<T> : IRequestHandler<GetOneByIdRequest<T>, T> where T : IBaseEntity
{
private readonly IAsyncRepository<T> _asyncRepository;
public GetOneByIdHandler(IAsyncRepository<T> asyncRepository)
{
_asyncRepository = asyncRepository;
}
public async Task<T> Handle(GetOneByIdRequest<T> request, CancellationToken cancellationToken)
{
return await _asyncRepository.GetOneByIdAsync(request.Id);
}
}
Right now I have to add the handler for every DTO manually. How can I automate this with Scrutor? Thanks!
services.AddTransient<IRequestHandler<GetOneByIdRequest<MyDto>, MyDto>, GetOneByIdHandler<MyDto>>();
Hi. I have a generic mediatr request handler which looks like this:
Right now I have to add the handler for every DTO manually. How can I automate this with Scrutor? Thanks!
services.AddTransient<IRequestHandler<GetOneByIdRequest<MyDto>, MyDto>, GetOneByIdHandler<MyDto>>();