Aiursoft.Scanner.Abstractions 8.0.0

Aiursoft Scanner

MIT licensed Pipeline stat Test Coverage NuGet version (Aiursoft.Scanner) ManHours

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!

Showing the top 20 packages that depend on Aiursoft.Scanner.Abstractions.

Packages Downloads
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
558
Aiursoft.Scanner
Automatic dependencies management system which powers Aiursoft
486
Aiursoft.DocGenerator
A tool for generating document for ASP.NET Core.
393
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
366
Aiursoft.Canon
Task fire and forget framework
301
Aiursoft.Canon
Task fire and forget framework
298
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
158
Aiursoft.Scanner
Automatic dependencies management system which powers Aiursoft
155
Aiursoft.Canon
Task fire and forget framework
152
Aiursoft.DocGenerator
A tool for generating document for ASP.NET Core.
151
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
140
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
124
Aiursoft.Canon
Task fire and forget framework
118
Aiursoft.Scanner
Automatic dependencies management system which powers Aiursoft
116
Aiursoft.Canon
Task fire and forget framework
34
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
31
Aiursoft.Canon
Task fire and forget framework
21
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
18
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
16
Aiursoft.CSTools
It contains many useful tools for CSharp developers.
15

.NET 8.0

  • No dependencies.

Version Downloads Last updated
8.0.0 1,112 03/25/2024
7.0.2 147 03/25/2024
7.0.1 158 03/26/2024
7.0.0 18 04/06/2024
6.0.11 13 04/06/2024