I have a project that originally written in .Netcore 3.1. I was migrating this project to .Net6.0.
I used to inject/Register the MediatR ServiceFactory with Lifetime: Transient.
services.AddTransient<ServiceFactory, ServiceFactory>();
But when I migrated to .Net6.0 I've got an error saying:
InvalidOperationException: Error while validating the service descriptor 'ServiceType: MediatR.ServiceFactory Lifetime: Transient ImplementationType: MediatR.ServiceFactory': Unable to resolve service for type 'System.Object' while attempting to activate 'MediatR.ServiceFactory'.
I would like to know how can I inject/Register the MediatR ServiceFactory in .Net6.0?
we shouldn't need to register the MediatR service factory as a separate thing. The AddMediatR extension should handle that.