Reputation: 10932
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?
Upvotes: 0
Views: 1750
Reputation: 1446
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://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection
Believe that native feature would be better than side implementation of this pattern.
Upvotes: 1