HG.EasyDi
3.0.0
dotnet add package HG.EasyDi --version 3.0.0
NuGet\Install-Package HG.EasyDi -Version 3.0.0
<PackageReference Include="HG.EasyDi" Version="3.0.0" />
paket add HG.EasyDi --version 3.0.0
#r "nuget: HG.EasyDi, 3.0.0"
// Install HG.EasyDi as a Cake Addin #addin nuget:?package=HG.EasyDi&version=3.0.0 // Install HG.EasyDi as a Cake Tool #tool nuget:?package=HG.EasyDi&version=3.0.0
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)]
or
[LazyDi(ServiceLifetime.Singleton)]
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 | 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- LazyProxy (>= 1.0.2)
- 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.