Asya.DependencyInjection
1.0.0
dotnet add package Asya.DependencyInjection --version 1.0.0
NuGet\Install-Package Asya.DependencyInjection -Version 1.0.0
<PackageReference Include="Asya.DependencyInjection" Version="1.0.0" />
paket add Asya.DependencyInjection --version 1.0.0
#r "nuget: Asya.DependencyInjection, 1.0.0"
// Install Asya.DependencyInjection as a Cake Addin
#addin nuget:?package=Asya.DependencyInjection&version=1.0.0
// Install Asya.DependencyInjection as a Cake Tool
#tool nuget:?package=Asya.DependencyInjection&version=1.0.0
Asya Dependency Injection a lightweight dependency injection assembly scanner
you can simply inject your dependencies with a smart attribute decoration and let the package take of your DI registration for the 4 common injection methods (Transient
, Singleton
, Scoped
, Hosted
) as following
let's talk about the injection after
I have created a simple interface with a single method as IExample.cs
and implementation as ExampleManager.cs
as following
using Asya.DependencyInjection.Attributes;
namespace Asya.DependencyInjection { [Scoped] public interface IExample { void Transaction(); } }
and the implementation
using System;
namespace Asya.DependencyInjection
{
public class ExampleManager: IExample
{
public void Transaction()
{
throw new NotImplementedException();
}
}
}
all you want is to mention the attribute as decoration on top of your interface or class you can use one of the following
[Scoped]
, [Singleton]
, [Transient]
, [Hosted]
then in your startup class you can simple inject this with single method as
service.ScanDependencies();
which will scan all services around your internal assembly and register each depended on the decoration attribute
OR
you can analysis you code with register each using the AddServiceOfType<TAttrubite>()
; as following
AddServiceOfType<Singleton>();
AddServiceOfType<Scoped>();
AddServiceOfType<Transient>();
AddServiceOfType<Hosted>();
which also will scan your assembly to get dependencies
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
-
net5.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Asya.DependencyInjection:
Package | Downloads |
---|---|
Asya.JwtManager
a lightweight JWT authentication manager thats allow you to work with JWT token easly and safe |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 461 | 9/5/2021 |
the initial release