Havit.Extensions.DependencyInjection.SourceGenerators 2.0.4

Prefix Reserved
dotnet add package Havit.Extensions.DependencyInjection.SourceGenerators --version 2.0.4
                    
NuGet\Install-Package Havit.Extensions.DependencyInjection.SourceGenerators -Version 2.0.4
                    
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="Havit.Extensions.DependencyInjection.SourceGenerators" Version="2.0.4">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Havit.Extensions.DependencyInjection.SourceGenerators" Version="2.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Havit.Extensions.DependencyInjection.SourceGenerators">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Havit.Extensions.DependencyInjection.SourceGenerators --version 2.0.4
                    
#r "nuget: Havit.Extensions.DependencyInjection.SourceGenerators, 2.0.4"
                    
#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.
#:package Havit.Extensions.DependencyInjection.SourceGenerators@2.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Havit.Extensions.DependencyInjection.SourceGenerators&version=2.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Havit.Extensions.DependencyInjection.SourceGenerators&version=2.0.4
                    
Install as a Cake Tool

HAVIT .NET Framework Extensions - Dependency Injection Source Generators

Účel nuget balíčku

  • Knihovna má usnadnit registraci služeb označených attributem [Service] do DI containeru.
  • Registrace je provedena bez použití reflexe v runtime. Použití reflexe je nahrazeno spuštěním kódu vygenerovaného source generátorem v compile time.

Jak balíček použít

  • Do všech projektů v solution, které používají [Service] atribut k označení služeb, které mají být zaregistrovány do DI containeru, zaregistrujte tento nuget balíček Havit.Extensions.DependencyInjection.SourceGenerators.
  • Source generator vygeneruje extension metodu Add[ProjectName]ByServiceAttribute.
  • V rámci registrace služeb do DI containeru použijte tuto vygenerovanou metodu (services.Add[ProjectName]ByServiceAttribute(profileName))

Migrace z předchozích řešení

  • Tam, kde používáme předchozí řešení spočívající ve volání extension metody AddByServiceAttribute, musíme odebrat nuget balíček Havit.Extensions.DependencyInjection ze všech projektů v solution (vč. případného pozůstatku v Directory.Packages.props). Typicky jde o jeden projekt v solution.
  • Odstranit volání extension metody AddByServiceAttribute(...), která používá reflexi, resp. nahradit toto volání postupem popsaným výše.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.4 5,141 11/7/2025
2.0.3 2,161 4/25/2025
2.0.2 625 3/25/2025
2.0.1 259 2/6/2025
0.9.0-pre04 185 1/20/2025
0.9.0-pre03 176 12/6/2024
0.9.0-pre02 158 12/5/2024
0.9.0-pre01 160 12/5/2024