I just started to learn ASP.NET MVC 5 and found a lot of tutorials about using the Unity ioc container for dependency injection.
I followed this great video to start: https://www.youtube.com/watch?v=E7Voso411Vs
when looking for the package to install, I saw:

I found this tutorial from October 2014 that shows how to use the Unity.Mvc framework. All it required is:
UnityConfig.cs and UnityMvcActivator.cs to App_Start.IUnitySample for example) and an implementationHomeController for example that takes a IUnitySample as a parameter. UnityConfig.cs in method RegisterTypes the register statement: container.RegisterType<IUnitySample, UnitySample>();No need to add anything in Application_Start method.
That seems very easy and it works, but from the more updated tutorials I read, it shows that people are using the Unity.Mvc5 package and not the Unity.Mvc.
What should I use to learn ASP.NET MVC 5? what are the differences between them? is one better than the other?
Unity.Mvc5 and Unity.Mvc are created by two different organizations and have different implementations.
Unity.Mvc5 creates a child container per web request. This works well with the built-in HierarchicalLifetimeManager.
Unity.Mvc does not create a child container, but instead chose to create a new LifetimeManager called PerRequestLifetimeManager.
Personally, I consider Unity.Mvc a better choice for its statistics (e.g .: total downloads) and because it shows a higher frequency of updates in the "Version History". Therefore it seems to be more followed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With