In ASP.NET MVC 5 is possible to obtain some dependency through DependencyResolver.Current.GetService
. Is there something similar in ASP.NET Core?
I think this could be a good start:
That's official documentation for dependency injection for asp.net 5.
Dependency injection is now built into asp.net 5 but you are free to use other libraries like autofac. The default one is working fine for me.
In your starup class, you have a method like this
public void ConfigureServices(IServiceCollection services)
{
//IServiceCollection acts like a container and you
//can register your classes like this:
services.AddTransient();
services.Singleton();
services.AddScoped();
}
From:
DependencyResolver Asp.net 5.0