asp.net mvc - Unity does not resolve the dependency -


i use unity unity.mvc5. class registers types , dependency resolver below:

public static class unityconfig {     public static void registercomponents()     {         var container = new unitycontainer();          container             .registertype<ilogger, nlogger>()             .registertype<idataaccesslayer, sqldataaccesslayer>()             .registertype<ieventbusiness, eventbusiness>();          dependencyresolver.setresolver(new unitydependencyresolver(container));      } } 

and here global.asax code:

void application_start(object sender, eventargs e) {     unityconfig.registercomponents();     globalconfiguration.configure(webapiconfig.register);     routeconfig.registerroutes(routetable.routes);   } 

in 1 of controllers have property this:

[dependency] public ieventbusiness eventbusiness { get; set; } 

i expect property set automatically unity it's null. can me figure out doing wrong?

thanks guys. removed unity.mvc5 , installed unity plus unity.bootstrapper instead. works fine. followed article resolve issue: http://msdn.microsoft.com/en-us/library/dn178463(v=pandp.30).aspx


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -