2

I cannot find a NuGet package for ASP.NET MVC5. I tried installing Unity.Mvc4 but the package manager refuses to add Unity.Mvc4.dll as reference, which is probably a good thing.

Suspect all I needed is UnityDependencyResolver so that I can set it up in Boostrapper like so:

  public static class Bootstrapper
    {
        public static IUnityContainer Initialise()
        {
            var container = BuildUnityContainer();         
            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
            return container;
        }

But this class is defined in Unity.Mvc4.dll. Anyone using Unity with MVC5? If so, how did you go about integration?

2 Answers 2

2

There is a package now in NuGet for Unity.Mvc5 by Paul Hiles.

Sign up to request clarification or add additional context in comments.

Comments

0

Implementation of UnityDependencyResolver is simpler than I had imagined.

I downloaded the source from CodePlex and just copied class into my project, then implemented Boostrapper.cs as usual.

Ensure your class is implementing interface System.Web.Mvc.IDependencyResolver and not System.Web.Http.Dependencies.IDependencyResolver.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.