14

I have heard that in the next version of ASP.NET (ASP.NET vnext) there will be dependency injection built into the framework. Does anyone know more about this? Will it be unity or a new framework? Where can I find more information about this?

1
  • 1
    Dependency injection is built into the framework. Use your preferred IoC container to register dependencies. reference : asp.net/vnext/overview/aspnet-vnext/overview Commented May 22, 2014 at 12:33

4 Answers 4

10

ASP.NET vNext will have built-in support for dependency injection. It is very basic support that currently supports only constructor injection.

The source repo for ASP.NET vNext's dependency injection logic contains sample implementations of how to wire up several community-built dependency injection systems, including Autofac, Ninject, StructureMap, Unity, and Castle Windsor. However, those are just samples and are not all complete or fully functional.

The idea is that for basic scenarios a developer can use the built-in DI, whereas people with more advanced requirements or if they already have a "favorite" DI system can plug that in instead and get richer features.

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

2 Comments

Se we finally get built-in support for the Dependency Injection pattern as well as the Service Locator pattern. Cool.
See also this discussion github.com/simpleinjector/SimpleInjector/issues/… pointing out that it might not be the best idea to replace the built-in container, but rather to use a custom container side-by-side.
3

It will contain common abstractions for Autofac, Ninject, StructureMap, Unity, Windsor as seen here Dependency Injection github If you see in the Project.Json it has dependencies on these specific frameworks.

1 Comment

Apparently, this will not be the case, at least not in the sense that ASP.NET vNext will contain those abstractions. It depends on the container providers, see also stackoverflow.com/questions/32788637/…
2

Here is instruction how to use Autofac with ASP.NET 5

Comments

1

This blog explains the details on hov to wire up your own container: http://blogs.msdn.com/b/webdev/archive/2014/06/17/dependency-injection-in-asp-net-vnext.aspx

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.