Microsoft.Extensions.DependencyInjection 9.0.0-preview.3.24172.9

About

Supports the dependency injection (DI) software design pattern which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies.

Key Features

Provides an implementation of the DI interfaces found in the Microsoft.Extensions.DependencyInjection.Abstractions package.

How to Use

ServiceCollection services = new ();
services.AddSingleton<IMessageWriter, MessageWriter>();
using ServiceProvider provider = services.BuildServiceProvider();

// The code below, following the IoC pattern, is typically only aware of the IMessageWriter interface, not the implementation.
IMessageWriter messageWriter = provider.GetService<IMessageWriter>()!;
messageWriter.Write("Hello");

public interface IMessageWriter
{
    void Write(string message);
}

internal class MessageWriter : IMessageWriter
{
    public void Write(string message)
    {
        Console.WriteLine($"MessageWriter.Write(message: \"{message}\")");
    }
}

Main Types

The main types provided by this library are:

  • Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory
  • Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions
  • Microsoft.Extensions.DependencyInjection.ServiceProvider

Additional Documentation

  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Microsoft.Extensions.Hosting
  • Microsoft.Extensions.Options

Feedback & Contributing

Microsoft.Extensions.DependencyInjection is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.Extensions.DependencyInjection.

Packages Downloads
DotNetCore.CAP
Eventually consistency in distributed architectures.
243
Microsoft.AspNetCore.Components.Web
Support for rendering ASP.NET Core components for browsers. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/d4eca39c3fc1944b2c6431bf6b22036bdb176c0d
17
Pomelo.EntityFrameworkCore.MySql
Pomelo's MySQL database provider for Entity Framework Core.
15
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
14
Pomelo.EntityFrameworkCore.MySql
Pomelo's MySQL database provider for Entity Framework Core.
13
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
12
Volo.Abp.Core
Package Description
10
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging. This package was built from the source code at https://github.com/aspnet/Extensions/tree/0de62ae930da31048ba7e54c8cd0c6c0bcbd9095
10
Volo.Abp.Core
Package Description
9
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
8
Volo.Abp.Core
Package Description
8
Microsoft.EntityFrameworkCore
Entity Framework Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations. EF Core works with SQL Server, Azure SQL Database, SQLite, Azure Cosmos DB, MySQL, PostgreSQL, and other databases through a provider plugin API. Commonly Used Types: Microsoft.EntityFrameworkCore.DbContext Microsoft.EntityFrameworkCore.DbSet
8

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET 8.0

.NET 9.0

.NET Standard 2.0

.NET Standard 2.1

Version Downloads Last updated
9.0.0-preview.3.24172.9 13 2024/5/10
8.0.0 14 2024/2/29
7.0.0 10 2023/7/15
6.0.1 8 2023/2/10
6.0.0 12 2022/7/18
5.0.2 17 2021/9/28
5.0.1 18 2021/9/28
5.0.0 13 2021/9/28
3.1.8 9 2022/9/12
3.1.6 7 2023/3/2
3.1.5 7 2022/9/12
3.1.2 8 2023/3/6
3.1.0 8 2022/9/12
3.0.1 7 2022/9/12
3.0.0 11 2023/5/28
2.2.0 11 2023/5/28
2.2.0-preview3-35497 8 2024/5/10
2.1.0 6 2023/8/11
2.0.0 11 2021/9/29