HG.EasyDi
2.3.1
See the version list below for details.
dotnet add package HG.EasyDi --version 2.3.1
NuGet\Install-Package HG.EasyDi -Version 2.3.1
<PackageReference Include="HG.EasyDi" Version="2.3.1" />
paket add HG.EasyDi --version 2.3.1
#r "nuget: HG.EasyDi, 2.3.1"
// Install HG.EasyDi as a Cake Addin #addin nuget:?package=HG.EasyDi&version=2.3.1 // Install HG.EasyDi as a Cake Tool #tool nuget:?package=HG.EasyDi&version=2.3.1
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
}
}
For register service as Lazy Proxy use :
[EasyDi(ServiceLifetime.Singleton, true)]
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
}
🤝 Contributing
Contributions are welcome! If you find a bug or have a feature suggestion, please open an issue on the GitHub repository.
📝 License
This project is licensed under the MIT License.
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. |
-
net6.0
- LazyProxy.ServiceProvider (>= 0.1.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.