Search code examples
c#unity-containermediatr

Do IAsyncRequests have to be register in DI


Using MediatR,

do IAsyncRequest<T> have to be registered in the container.

I've got Unity auto registering everything and quite rightly it's complaining that I have multiple bindings against IAsyncRequest<bool>.

So I figure I have two options, don't register IAsyncRequest<T> or don't auto register IAsyncRequest<T>, give them named registrations.

I think doing the former is the easiest, and I was just wondering if there was any special reason to have the IAsyncRequest registered to their concrete impls.


Solution

  • No they do not. Only handlers need to be registered. Check out the GitHub repo for a working example of Unity registration.