BigO.DependencyInjection 2.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BigO.DependencyInjection --version 2.3.0                
NuGet\Install-Package BigO.DependencyInjection -Version 2.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BigO.DependencyInjection" Version="2.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BigO.DependencyInjection --version 2.3.0                
#r "nuget: BigO.DependencyInjection, 2.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BigO.DependencyInjection as a Cake Addin
#addin nuget:?package=BigO.DependencyInjection&version=2.3.0

// Install BigO.DependencyInjection as a Cake Tool
#tool nuget:?package=BigO.DependencyInjection&version=2.3.0                

BigO.DependencyInjection

NuGet version

BigO.DependencyInjection provides a set of utilities to streamline and enhance dependency injection in .NET projects. This package aims to simplify common dependency injection patterns, making your code more maintainable and testable.

Features

  • Service Registration: Easily register services with various lifetimes (singleton, scoped, transient).
  • Decorator Support: Apply decorators to services seamlessly.
  • Factory Registration: Register services with factory methods.

Installation

Install via NuGet Package Manager Console:

Install-Package BigO.DependencyInjection

Or via .NET CLI:

dotnet add package BigO.DependencyInjection

Usage

Registering Services

using BigO.DependencyInjection;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddBigOService<MyService>(ServiceLifetime.Singleton);
    }
}

Applying Decorators

services.AddDecoratedService<IMyService, MyService, MyServiceDecorator>(ServiceLifetime.Scoped);

Registering with Factory

services.AddFactoryService<IMyService>(sp => new MyService(sp.GetRequiredService<IOtherService>()));

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bugs or features.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on BigO.DependencyInjection:

Package Downloads
BigO.Cqrs

BigO.Cqrs contains base utilities and extensions dealing with CQRS.

BigO.Domain

A toolset of selected extensions and utilities to assist with learning/development tasks revolving around domain driven design.

BigO.Security

The package contains useful utilities for development around security in .NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.0 40 7/19/2024
2.3.1 83 7/7/2024
2.3.0 66 7/7/2024
2.2.0 104 6/13/2024
2.1.0 118 4/6/2024
2.0.1 115 4/4/2024
2.0.0 251 11/29/2023
1.1.0 319 3/30/2023
1.0.0 309 1/5/2023