Aiursoft.Scanner
7.0.2
See the version list below for details.
dotnet add package Aiursoft.Scanner --version 7.0.2
NuGet\Install-Package Aiursoft.Scanner -Version 7.0.2
<PackageReference Include="Aiursoft.Scanner" Version="7.0.2" />
paket add Aiursoft.Scanner --version 7.0.2
#r "nuget: Aiursoft.Scanner, 7.0.2"
// Install Aiursoft.Scanner as a Cake Addin #addin nuget:?package=Aiursoft.Scanner&version=7.0.2 // Install Aiursoft.Scanner as a Cake Tool #tool nuget:?package=Aiursoft.Scanner&version=7.0.2
Aiursoft Scanner
An Automatic dependencies management system for ASP.NET Core and powers Aiursoft.
Why this project
The traditional way to add dependencies is:
service.AddScoped<MyScopedDependency>();
Which means that you have to manually inject all dependencies. When you have too many of them, it is possible to make a mistake.
How to use Aiursoft.Scanner
First, install Aiursoft.Scanner
to your ASP.NET Core project from nuget.org:
dotnet add package Aiursoft.Scanner
Add the interface to your class like this:
using Aiursoft.Scanner.Abstractions;
public class MySingletonService : ISingletonDependency
{
}
public class MyScopedService : IScopedDependency
{
}
public class MyTransientService : ITransientDependency
{
}
And just call this in your StartUp.cs
:
using Aiursoft.Scanner;
services.AddScannedDependencies();
That's all! All your dependencies are registered. Just use it like previous before:
public class MyController : Controller
{
private readonly MyScopedService _service;
public MyController(MyScopedService service)
{
_service = service;
}
}
Advanced usage
When you want to register a dependency that implements an abstract, your previous way is:
public class MyClass : IAbstract
{
}
service.AddScoped<IAbstract, MyClass>();
That's fine. But now we want to register this automatically.
Add the dependency interface to your service like this:
public class MyClass : IAbstract, IScopedDependency
{
}
When you are registering all dependencies in your StartUp.cs
, tell us that your project supports your abstract.
services.AddScannedDependencies(typeof(IAbstract));
And you can call it with multiple abstracts:
services.AddScannedDependencies(typeof(IAbstract1), typeof(IAbstract2), typeof(IAbstract3));
That's all! Enjoy!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- Aiursoft.Scanner.Abstractions (>= 7.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Aiursoft.Scanner:
Repository | Stars |
---|---|
AiursoftWeb/Infrastructures
Mirror of: https://gitlab.aiursoft.cn/aiursoft/infrastructures
|
Version | Downloads | Last updated |
---|---|---|
9.0.3 | 42 | 2/12/2025 |
9.0.2 | 58 | 1/15/2025 |
9.0.1 | 97 | 12/29/2024 |
8.0.2 | 254 | 10/9/2024 |
8.0.1 | 211 | 3/12/2024 |
8.0.0 | 442 | 2/19/2024 |
7.0.2 | 142 | 1/30/2024 |
7.0.1 | 2,125 | 11/2/2023 |
7.0.0 | 1,258 | 9/5/2023 |
6.0.11 | 959 | 6/24/2023 |
6.0.10 | 606 | 6/7/2023 |
6.0.9 | 2,701 | 5/15/2023 |
6.0.8 | 497 | 5/11/2023 |
6.0.7 | 3,196 | 8/4/2022 |
6.0.6 | 1,731 | 7/6/2022 |
6.0.5 | 1,991 | 5/13/2022 |
6.0.0 | 2,235 | 3/27/2022 |
5.0.9 | 1,895 | 5/31/2021 |
5.0.8 | 1,859 | 5/23/2021 |
5.0.7 | 1,717 | 5/7/2021 |
5.0.6 | 1,723 | 4/14/2021 |
5.0.5 | 1,877 | 2/16/2021 |
5.0.4 | 2,215 | 1/29/2021 |
5.0.3 | 1,816 | 1/27/2021 |
5.0.2 | 1,914 | 12/9/2020 |
5.0.1 | 1,893 | 11/30/2020 |
5.0.0 | 1,752 | 11/14/2020 |
3.2.11 | 2,569 | 10/18/2020 |
3.2.10 | 2,698 | 10/3/2020 |
3.2.9 | 2,420 | 10/2/2020 |
3.2.8 | 2,580 | 9/10/2020 |
3.2.7 | 2,539 | 9/2/2020 |
3.2.6 | 2,700 | 8/12/2020 |
3.2.5 | 2,757 | 7/31/2020 |
3.2.4 | 2,779 | 7/3/2020 |
3.2.3 | 2,629 | 6/25/2020 |
3.2.2 | 2,568 | 6/18/2020 |
3.2.1 | 3,105 | 6/5/2020 |
3.2.0 | 2,894 | 6/4/2020 |
3.1.14 | 3,021 | 6/4/2020 |
3.1.13 | 2,323 | 5/25/2020 |
3.1.12 | 2,199 | 5/20/2020 |
3.1.11 | 2,161 | 5/18/2020 |
3.1.10 | 2,255 | 5/18/2020 |
3.1.9 | 2,182 | 5/17/2020 |
3.1.8 | 2,355 | 5/12/2020 |
3.1.7 | 2,356 | 5/2/2020 |
3.1.6 | 2,271 | 5/1/2020 |
3.1.5 | 2,258 | 4/21/2020 |
3.1.4 | 822 | 4/19/2020 |
3.1.3 | 1,080 | 4/15/2020 |
3.1.2.2 | 1,814 | 4/6/2020 |
3.1.2.1 | 1,637 | 3/19/2020 |
3.1.2 | 1,706 | 2/21/2020 |
3.1.1.8 | 1,312 | 2/17/2020 |
3.1.1.7 | 1,381 | 2/14/2020 |
3.1.1.6 | 1,143 | 1/28/2020 |
3.1.1.5 | 1,418 | 1/22/2020 |
3.1.1.4 | 1,060 | 1/21/2020 |
3.1.1.3 | 1,373 | 1/21/2020 |
3.1.1.2 | 1,867 | 1/20/2020 |