简体   繁体   中英

Which Nuget Unity packages for ASP.NET MVC 5?

I'm working on an ASP.NET MVC5 project that relies on Unity (IoC) for DI. The other day I started watching the Pluralsight course "Practical IoC with ASP.NET MVC 4" and the guy doing that course chooses the Unity for MVC 4 package over the Unity package (talking Nuget packages here) where obviously you setup everything in a file called Bootstrapper.cs, which, as I understand it, is created and wired up by that Nuget package.

My project doesn't have this file, but actually references Unity.Mvc4 (the one that's recommended in the course). The Nuget package manager tells me that Unity.MVC4 and Unity are both installed and that Unity.MVC4 depends on Unity.

To make matters worse, there also is Unity.MVC5 and Unity bootstrapper for ASP.NET MVC available from nuget.org. Is it just me, or is that a tiny bit confusing?

Can anybody please shed some light on which Unity packages actually make sense with MVC 5?

This won't help anyone using MVC 5, but ASP.NET Core has own DI implementation, take a look: http://blogs.msdn.com/b/webdev/archive/2014/06/17/dependency-injection-in-asp-net-vnext.aspx and https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection

Believe that native feature would be better than side implementation of this pattern.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM