Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net vnext Dependency Injection

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?

like image 508
Alexander Avatar asked May 22 '14 12:05

Alexander


People also ask

Does ASP NET support dependency injection?

ASP.NET Core supports the dependency injection (DI) software design pattern, which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies. For more information specific to dependency injection within MVC controllers, see Dependency injection into controllers in ASP.NET Core.

What is vNext?

vNext uses the Roslyn compiler to compile code dynamically. You will be able to edit a code file, refresh the browser, and see the changes without rebuilding the project. vNext is open source and cross platform.

What is .NET dependency injection?

Dependency injection in .NET is a built-in part of the framework, along with configuration, logging, and the options pattern. A dependency is an object that another object depends on. Examine the following MessageWriter class with a Write method that other classes depend on: C# Copy.

How is dependency injection done in .NET Core?

The interface-based dependency injection can be achieved by creating the common interface and other classes are implements this interface to inject the dependency. In this type of DI, we can use either constructor injection or setter injection. There is a built-in support of dependency injection in ASP.net Core.


1 Answers

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.

like image 156
Eilon Avatar answered Oct 04 '22 23:10

Eilon