HG.EasyDi
1.2.5
See the version list below for details.
dotnet add package HG.EasyDi --version 1.2.5
NuGet\Install-Package HG.EasyDi -Version 1.2.5
<PackageReference Include="HG.EasyDi" Version="1.2.5" />
paket add HG.EasyDi --version 1.2.5
#r "nuget: HG.EasyDi, 1.2.5"
// Install HG.EasyDi as a Cake Addin #addin nuget:?package=HG.EasyDi&version=1.2.5 // Install HG.EasyDi as a Cake Tool #tool nuget:?package=HG.EasyDi&version=1.2.5
HG.EasyDi
🧩 HG.EasyDi is a lightweight dependency injection library for ASP.NET Core.
Features
✨ Easy integration with ASP.NET Core applications.
✨ Attribute-based service registration.
✨ Support for singleton, scoped, and transient lifetimes.
✨ Automatic scanning of namespaces for service registration.
🔥 Installation
You can install the HG.EasyDi package via NuGet package manager or by adding it directly to your project file.
dotnet add package HG.EasyDi
🪧 Usage
Define your services and interfaces:
public interface ISampleService
{
void DoSomething();
}
[EasyDi(ServiceLifetime.Singleton)]
public class SampleService : ISampleService
{
public void DoSomething()
{
// Implementation code here
}
}
Register services in your Program.cs file:
Full Scan:
builder.Services.AddEasyDi();
Scan special namespace:
builder.Services.AddEasyDi(o=>o.SetNamespaceRootToScan("HG.EasyDi.PlantTest.Service"));
Inject and use the services in your controllers or other classes:
public class SampleController : ControllerBase
{
private readonly ISampleService _sampleService;
public SampleController(ISampleService sampleService)
{
_sampleService = sampleService;
}
// Controller actions
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.