Dependency injection support with .NET Core

Microsoft has now supplied support for dependency injection directly with .NET Core in the form of extensions with the Microsoft.Extensions.DependencyInjection NuGet package. The support for DI in .NET Core is in a way that you can either use the provided DI implementation, or you can use given DI interfaces in Microsoft.Extensions.DependencyInjection.Abstractions and use it with the DI framework implementation of your choice, for example, Ninject.

Just to give you an idea of the .NET Core direction, a similar behavior or style is also designed with a logging framework in .NET Core using the Microsoft.Extensions.Logging.Abstractions package.

Let's look at an example to see the Microsoft DI in motion ...

Get Enterprise Application Architecture with .NET Core now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.