Essy.DependencyManagement.Injection.Generator
1.1.0
See the version list below for details.
dotnet add package Essy.DependencyManagement.Injection.Generator --version 1.1.0
NuGet\Install-Package Essy.DependencyManagement.Injection.Generator -Version 1.1.0
<PackageReference Include="Essy.DependencyManagement.Injection.Generator" Version="1.1.0" />
paket add Essy.DependencyManagement.Injection.Generator --version 1.1.0
#r "nuget: Essy.DependencyManagement.Injection.Generator, 1.1.0"
// Install Essy.DependencyManagement.Injection.Generator as a Cake Addin #addin nuget:?package=Essy.DependencyManagement.Injection.Generator&version=1.1.0 // Install Essy.DependencyManagement.Injection.Generator as a Cake Tool #tool nuget:?package=Essy.DependencyManagement.Injection.Generator&version=1.1.0
<a href="https://www.nuget.org/profiles/essy-ecosystem"> <img src="Assets/icon-128-preview.png" alt="NuGet" width="64" /> </a>
Dependency Management
The Dependency Management is a very fast dependency injection and components container, with many interesting features, and without reflexion.
Its allows you to make your project more extensible and modular.
Features
The project contains many extensions (eg - modularity) and nuances that are not described here, read the documentation.
- Without any reflection. Only ( optional) code generation.
- Faster than other popular same projects, such as Autofac , Niject, other.
- Supports DotNet 6, 7, also Native AOT , Nullable.
- The project is extremely modular and can easily be expanded from the outside, as it uses a components system.
Example
This example is very primitive and does not allow you to take into all the features of the project.
Dependency.cs
public sealed class Dependency { }
Service.cs
public sealed class Service
{
private readonly Dependency _dependency;
public Service(Dependency dependency)
{
_dependency = dependency;
}
}
With Code Generator
Program.cs
await using var container = new Container()
.WithStrategies()
.WithProviders();
container.SetTarget<Dependency>().ToSingleton();
container.SetTarget<Service>().ToTransient();
var readOnlyContainer = container.ToReadOnly();
var service = readOnlyContainer.LastInstance<Service>();
Without Code Generator
Program.cs
await using var container = new Container().WithStrategies();
container.SetTarget<Dependency>()
.With(_ => new())
.ToSingleton();
container.SetTarget<Service>()
.With(c => new(c.LastInstance<Dependency>()))
.ToTransient();
var readOnlyContainer = composite.ToReadOnly();
var service = readOnlyContainer.LastInstance<Service>();
Installation
<PropertyGroup>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="Essy.DependencyManagement.Injection" Version="1.1.0"/>
<ProjectReference Include="Essy.DependencyManagement.Injection.Generator" Version="1.1.0" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all"/>
<ProjectReference Include="Essy.DependencyManagement.Modularity" Version="1.1.0"/>
<ProjectReference Include="Essy.DependencyManagement.Modularity.Generator" Version="1.1.0" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all"/>
</ItemGroup>
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Dependency Management is licensed under MIT license.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.3.0-2.final)
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 |
---|---|---|
1.4.3 | 178 | 10/3/2022 |
1.4.2 | 117 | 10/3/2022 |
1.4.1 | 118 | 9/30/2022 |
1.4.0 | 112 | 9/30/2022 |
1.3.0 | 121 | 9/11/2022 |
1.2.0 | 110 | 9/3/2022 |
1.1.1 | 112 | 9/2/2022 |
1.1.0 | 105 | 9/2/2022 |
1.0.5 | 109 | 9/2/2022 |
1.0.4-alpha | 111 | 8/16/2022 |
1.0.3-alpha | 117 | 8/11/2022 |
1.0.2-alpha | 123 | 8/11/2022 |
1.0.1-alpha | 128 | 8/10/2022 |
1.0.0-alpha | 115 | 8/10/2022 |