How to add new ServiceCollectionExtension to the existing mediator?
HI Jimmy Thanks for the greate tool. I really enjoy using it is there any way to add new ServiceCollectionExtension to the existing mediator? I try to find it in the documentations. but unfortunately couldn't find anything. I have a mediator which I am making at application start and using it. during the usage of the application, based on the user choices I need to add new ServiceCollectionExtension to it. since I don't know how, i have to make another instance of mediator. Thank you in advanced
Hi ashk,
you can just recall services.AddMediatR(...), it will take care by only adding the IMediator service when it has not been registered before.
See https://github.com/jbogard/MediatR.Extensions.Microsoft.DependencyInjection/blob/1ed8e74ad35b89d1ef460b8433af2b92bee8bcfd/src/MediatR.Extensions.Microsoft.DependencyInjection/Registration/ServiceRegistrar.cs#L216