简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM