c# - Unity.Mvc vs Unity.Mvc5 differences -
i started learn asp.net mvc 5 , found lot of tutorials using unity ioc container dependency injection.
i followed great video start: https://www.youtube.com/watch?v=e7voso411vs
when looking package install, saw:
i found this tutorial october 2014 shows how use unity.mvc framework. required is:
- adding package (automatically adding
unityconfig.cs
,unitymvcactivator.cs
app_start. - create interface (
iunitysample
example) , implementation - adding constructor
homecontroller
example takesiunitysample
parameter. - and finally, add
unityconfig.cs
in method registertypes register statement:container.registertype<iunitysample, unitysample>();
no need add in application_start
method.
that seems easy , works, more updated tutorials read, shows people using unity.mvc5 package , not unity.mvc.
what should use learn asp.net mvc 5? differences between them? 1 better other?
unity.mvc5 , unity.mvc created 2 different organizations , have different implementations.
unity.mvc5 creates child container per web request. works built-in hierarchicallifetimemanager
.
unity.mvc not create child container, instead chose create new lifetimemanager called perrequestlifetimemanager
.
Comments
Post a Comment