You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use generic handlers with notifications. Due to I was not able to do it, I have changed to generic requests.
And now I'm getting the below error message.
Issue error message
System.InvalidOperationException: No service for type 'MediatR.IRequestHandler`1[NotificationsMediatR.Notifications.GenericBasicTypeNotification`1[System.String]]' has been registered.
//...// Inject MediatRservices.AddMediatR(cfg =>{cfg.MaxTypesClosing=0;cfg.RegisterGenericHandlers=true;cfg.RegisterServicesFromAssembly(typeof(Startup).Assembly);});services.AddSingleton<IMediator,Mediator>();services.AddTransient<BaseWithoutResponseTopicHandler>();services.AddTransient(typeof(GenericBaseTypeNoResponseHandler<>));services.AddTransient<GenericBaseTypeNoResponseHandler<string>>();// Theoretically it is not needed//...
Configure method
// set the mediatRvarmediatR=LocalMediatR.GetInstance();mediatR.SetMediatR(mediator);
Environment
Issue description
I want to use generic handlers with notifications. Due to I was not able to do it, I have changed to generic requests.
And now I'm getting the below error message.
Issue error message
Source code
Handlers
Configure services
Configure
methodExample of use and it generates the error
other links read and tests performed
The text was updated successfully, but these errors were encountered: