Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual registration of generic handler works, but automatic doesn't. #1087

Open
matteo-mosca opened this issue Nov 17, 2024 · 0 comments
Open

Comments

@matteo-mosca
Copy link

If I make the following registration:

builder.Services.AddScoped<IRequestHandler<CreateCommand<CreateClientDto, ClientEntity>, Result<ClientEntity>>, CreateHandler<CreateClientDto, ClientEntity>>();

Then at runtime everything is resolved and works. But if I leave it to automatic registration with RegisterGenericHandlers = true I have some weird error (namespaces redacted for brevity, everything is in the same assembly):

System.InvalidOperationException: No service for type 'MediatR.IRequestHandler2[CreateCommand2[CreateClientDto,ClientEntity],Result1[ClientEntity]]' has been registered.`

Which is extremely weird, because manual registration of the very same works.

Am I missing something? I can provide more code if anyone thinks it matters, I honestly think it doesnt, like my classes implementations and such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant