How can I get service provider from service collection?
Hello, everyone.
am working on console app using meditR, want to get service provider from service collection.
I've got a compile error on ServiceCollection.BuildServiceProvider

5 Replies
Since you seem to be using DI here, why not make
UrlController
a part of the DI container as well, and simply inject the IMediator
?
Setting up DI and then not using DI is counterproductive
but yeah, agree with ZZZZZZ, register your controller too
let it resolve the mediator internally
services.BuildServiceProvider();
I have a compile error here
Are we... supposed to know what error it is?
ah seems working now, vs code is full of bugs, restarted it and its fine now
btw, I didnt do anything just restarted my IDE
Thanks anyway @ZZZZZZZZZZZZZZZZZZZZZZZZZ @Pobiega