I want to use the official way of registering the Mediator service in the start up application, but since I'm using Autofac on top IServiceCollection, I'd rather register the different implementations of IRequestHandler<,> in the different Autofac modules spread across the solution.
Therefore, my Startup type only contains this:
services.AddMediatR(_ => {});
Only to be greeted with this helpful exception telling me I probably forgot to supply an assembly to scan. Perhaps there could be something added to prevent this? I mean other than having to add a dummy line that scans an assembly that has no request handlers?
Look at the ServiceRegistrar class that exposes a method AddRequredServices to add the required services (i.e., none of the handlers). You'll then just not use AddMediatR.
Well this is awkward.
I want to use the official way of registering the Mediator service in the start up application, but since I'm using Autofac on top IServiceCollection, I'd rather register the different implementations of
IRequestHandler<,>
in the different Autofac modules spread across the solution.Therefore, my Startup type only contains this:
Only to be greeted with this helpful exception telling me I probably forgot to supply an assembly to scan. Perhaps there could be something added to prevent this? I mean other than having to add a dummy line that scans an assembly that has no request handlers?