HG.EasyDi 2.5.2

dotnet add package HG.EasyDi --version 2.5.2                
NuGet\Install-Package HG.EasyDi -Version 2.5.2                
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="HG.EasyDi" Version="2.5.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HG.EasyDi --version 2.5.2                
#r "nuget: HG.EasyDi, 2.5.2"                
#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.
// Install HG.EasyDi as a Cake Addin
#addin nuget:?package=HG.EasyDi&version=2.5.2

// Install HG.EasyDi as a Cake Tool
#tool nuget:?package=HG.EasyDi&version=2.5.2                

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 
[LasyDi(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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5.2 200 9/24/2023
2.5.1 150 9/24/2023 2.5.1 is deprecated because it has critical bugs.
2.3.1 146 9/22/2023
1.2.6 229 7/15/2023
1.2.5 174 7/13/2023
1.2.0 169 7/12/2023 1.2.0 is deprecated because it is no longer maintained.