c# - MVC5 Identity with DI (Removing Service Locator anti-pattern) -


i trying remove service locator anti pattern comes default new mvc5 project. attempting implement di instead using ninject. have come upon following guide meant unity, not mvc5 application.

http://tech.trailmax.info/2014/09/aspnet-identity-and-ioc-container-registration/

from can tell, there not difference in code between article , new mvc5 application. there 1 thing cannot seem figure out with.

in article provided above exists following method

private static void registertypes(iunitycontainer container) {     container.registertype<applicationdbcontext>();     container.registertype<applicationsigninmanager>();     container.registertype<applicationusermanager>(); } 

i trying understand container , register classes in mvc5. need register classes container begin with? still learning here , i'm quite new mvc5 , identity appreciated.

the container contains configuration settings each abstraction , implementation. container used create dependencies , inject them automatically when required. whenever there need of instance of abstraction, container provides requester. automatically creates objects based on request , inject them when required. container helps manage dependencies in application in simple , easy way.


Comments