Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to get instance using IServiceCollection

$
0
0

I have added a class in  ConfigureServices(IServiceCollection services)  as services.AddInstance<IConfiguration>(Configuration);I want to get the instance in my HostConfiguration.cs class, I can get it in controller, problem is how can i get it in any other class?

In unity we can use ServiceLocator to get instance, Now in MVC 6 how can i get it?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>