Microsoft.Extensions.DependencyInjection 8.0.1

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
Parbad
Parbad is a free, open-source, integrated and extensible library which connects your web applications to online payment gateways. Gateways can be added or developed by you. The Virtual Gateway also simulates the online payment process, which helps the application development. More information: https://github.com/Sina-Soltani/Parbad پَرباد یک کتابخانه رایگان و اوپن سورس است که امکان افزودن پرداخت آنلاین را به وب اپلیکیشن‌ها محیا میکند. درگاه‌های شبکه شتاب: ملت، ملی، سامان، پارسیان، پاسارگاد، آسان پرداخت و ایران کیش
5
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
4
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
3

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

Version Downloads Last updated
8.0.1 4 06/29/2025