Injectio 1.0.20

There is a newer version of this package available.
See the version list below for details.
dotnet add package Injectio --version 1.0.20                
NuGet\Install-Package Injectio -Version 1.0.20                
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="Injectio" Version="1.0.20" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Injectio --version 1.0.20                
#r "nuget: Injectio, 1.0.20"                
#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 Injectio as a Cake Addin
#addin nuget:?package=Injectio&version=1.0.20

// Install Injectio as a Cake Tool
#tool nuget:?package=Injectio&version=1.0.20                

Injectio

Source generator that automatically registers discovered services in the dependency injection container

Features

  • Transient, Singleton, Scoped service registration
  • Factory registration
  • Module registration
  • Duplicate Strategy - Skip,Replace,Append
  • Registration Strategy - Self, Implemented Interfaces, Self With Interfaces

Usage

Add package

Add the package project to your projects.

dotnet add package Injectio

Prevent dependances from including Injectio

<PackageReference Include="Injectio" PrivateAssets="all" />
Add to container

Call the generated extension method to add to the service container. The method will be called Add[AssemblyName]. The assemlby name will have the dots removed.

var services = new ServiceCollection();
services.AddInjectioTestsConsole();

Attributes

Singleton services

Place registration attribute on class. The class will be discovered and regirsted.

[RegisterSingleton]
public class SingletonService : IService { }

Explicit service type

[RegisterSingleton(ServiceType = typeof(IService))]
public class SingletonService : IService { }
Scoped Services
[RegisterScoped]
public class ScopedService : IService { }
Transient Services
[RegisterTransient]
public class TransientService : IService { }
Factories
[RegisterTransient(ServiceType = typeof(IService), Factory = nameof(ServiceFactory))]
public class FactoryService : IService
{
    public static object ServiceFactory(IServiceProvider serviceProvider)
    {
        return new FactoryService1();
    }
}
Modules
public class RegistrationModule
{
    [RegisterModule]
    public static void Register(IServiceCollection services)
    {
        services.TryAddTransient<IModuleService, ModuleService>();
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Injectio:

Package Downloads
NoeticTools.Git2SemVer.Core

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Injectio:

Repository Stars
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
loresoft/EntityFrameworkCore.Generator
Generate Entity Framework Core model from an existing database
Version Downloads Last updated
4.0.0 7,755 11/14/2024
3.3.0 11,057 9/7/2024
3.2.0 245 9/5/2024
3.1.0 54,166 12/5/2023
3.0.1 587 11/29/2023
3.0.0 292 11/24/2023
3.0.0-beta.3 78 11/21/2023
3.0.0-beta.2 75 11/16/2023
3.0.0-beta.1 68 11/16/2023
2.7.0 2,558 10/25/2023
2.6.2 5,312 8/9/2023
2.6.1 515 7/29/2023
2.6.0 134 7/29/2023
2.5.87 5,091 3/25/2023
2.5.65 4,620 1/30/2023
2.0.54 1,271 1/2/2023
2.0.52 264 1/2/2023
2.0.43 339 12/28/2022
1.0.33 1,025 10/25/2022
1.0.30 362 10/24/2022
1.0.28 343 10/22/2022
1.0.25 337 10/21/2022
1.0.23 407 10/20/2022
1.0.20 368 10/20/2022
1.0.18 366 10/20/2022
1.0.16 349 10/5/2022
1.0.14 352 10/5/2022
1.0.12 356 10/5/2022
1.0.10 334 10/4/2022
1.0.8 432 9/25/2022