What dependency does ASP.NET Core use?

I got started in ASP.Net Core and found that Dependency Injection is a first-class citizen in the ASP.Net Core framework and that it is built in and ready to be used for injection of various services and libraries.

I would like to know which Dependency Injection framework they are using. Their docs on Introducing Dependency Injection in ASP.NET Core

ASP.NET Core is designed from the ground up to support and leverage dependency dependencies. ASP.NET Core apps can use built-in infrastructure services by injecting them into methods in the Startup class, and apps can also be configured for injection

Did they come up with their own ideas? Or they reuse the existing open source Injection framework. If so, which one?

The reason for asking, apart from natural curiosity, is also that I want to use the same framework they use in ASP.Net Core in my .Net 4.6.1.

ASP.Net Web API .

Because I found most DI frameworks are very slow and bloated, even Unity .

In contrast, the ASP.Net CORE DI framework seems to be very fast and accurate.

+3


source to share


1 answer


.NET Core is open source, so we can look at this for ourselves. Base repo:

https://github.com/dotnet/corefx

And the ASP.NET Core Repo is located at:



https://github.com/aspnet/home

Going to the DependencyInjection repos ( https://github.com/aspnet/DependencyInjection ), and going to the source, we find https://github.com/aspnet/DependencyInjection/blob/dev/src/Microsoft.Extensions.DependencyInjection/ServiceProvider .cs

Reading through this file seems to look like a DI container. To be fair, it should be said that Microsoft wrote their own, although they also support using existing ones as per the documentation in the Dependency Injection repository.

+2


source







All Articles