Microsoft.Extensions.DependencyInjection 9.0.0

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
SanedBuildingBlocks
This package built for OIG-Saned
3,423
SanedBuildingBlocks
This package built for OIG-Saned
2,420
SanedBuildingBlocks
This package built for OIG-Saned
912
SanedBuildingBlocks
This package built for OIG-Saned
833
SanedBuildingBlocks
This package built for OIG-Saned
753
SanedBuildingBlocks
This package built for OIG-Saned
647
SanedBuildingBlocks
This package built for OIG-Saned
456
SanedBuildingBlocks
This package built for OIG-Saned
422
SanedBuildingBlocks
This package built for OIG-Saned
276
SanedBuildingBlocks
This package built for OIG-Saned
269
SanedBuildingBlocks
This package built for OIG-Saned
221
SanedBuildingBlocks
This package built for OIG-Saned
191
SanedBuildingBlocks
This package built for OIG-Saned
186
SanedBuildingBlocks
This package built for OIG-Saned
184
SanedBuildingBlocks
This package built for OIG-Saned
158
SanedBuildingBlocks
This package built for OIG-Saned
125
SanedBuildingBlocks
This package built for OIG-Saned
121
SanedBuildingBlocks
This package built for OIG-Saned
118
SanedBuildingBlocks
This package built for OIG-Saned
115
SanedBuildingBlocks
This package built for OIG-Saned
110

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

Version Downloads Last updated
9.0.0 16 12/01/2024
6.0.1 15 06/17/2023
3.1.18 14 10/08/2023
3.1.5 15 08/16/2023
3.1.0 14 10/02/2023
2.1.0 14 09/05/2023
2.0.0 13 06/16/2023