Jinget.Core.DiScanner 6.2.18-preview010

Prefix Reserved
This is a prerelease version of Jinget.Core.DiScanner.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Jinget.Core.DiScanner --version 6.2.18-preview010                
NuGet\Install-Package Jinget.Core.DiScanner -Version 6.2.18-preview010                
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="Jinget.Core.DiScanner" Version="6.2.18-preview010" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jinget.Core.DiScanner --version 6.2.18-preview010                
#r "nuget: Jinget.Core.DiScanner, 6.2.18-preview010"                
#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 Jinget.Core.DiScanner as a Cake Addin
#addin nuget:?package=Jinget.Core.DiScanner&version=6.2.18-preview010&prerelease

// Install Jinget.Core.DiScanner as a Cake Tool
#tool nuget:?package=Jinget.Core.DiScanner&version=6.2.18-preview010&prerelease                

Jinget.Core.DiScanner

Using this library, you can easily register your source code dependencies automatically without the need to write repetitive and annoying codes.

Attention: This package is build based on Autofac assembly scanning.

How to Use:

Download the package from NuGet using Package Manager: Install-Package Jinget.Core.DiScanner You can also use other methods supported by NuGet. Check Here for more information.

Methods

Assembly Selector

Name Description
FromCallingAssembly Will scan for types from the calling assembly
FromExecutingAssembly Will scan for types from the currently executing assembly
FromEntryAssembly Will scan for types from the entry assembly
FromApplicationDependencies Will load and scan all runtime libraries referenced by the currently executing application
FromAssemblyDependencies Will load and scan all runtime libraries referenced by the currently specified assembly
FromDependencyContext Will load and scan all runtime libraries in the given context
FromAssemblyOf Will scan for types from the assembly of type T
FromAssemblies Will scan for types in each Assembly in assemblies

Service Type Selector

Name Description
AsSelf Registers each matching concrete type as itself
FromExecutingAssembly Will scan for types from the currently executing assembly
As Registers each matching concrete type
AsImplementedInterfaces Registers each matching concrete type as all of its implemented interfaces
AsSelfWithInterfaces Registers each matching concrete type as all of its implemented interfaces, by returning an instance of the main type
AsMatchingInterface Registers the type with the first found matching interface name. (e.g. ClassName is matched to IClassName)
UsingAttributes Registers each matching concrete type according to their ServiceDescriptorAttribute

Implementation Type Selector

Name Description
AddClasses Adds all non-abstract classes from the selected assemblies to the Microsoft.Extensions.DependencyInjection.IServiceCollection

Lifetime Selector

Name Description
WithSingletonLifetime Registers each matching concrete type with ServiceLifetime.Singleton lifetime
WithScopedLifetime Registers each matching concrete type with ServiceLifetime.Scoped lifetime
WithTransientLifetime Registers each matching concrete type with ServiceLifetime.Transient lifetime
WithLifetime Registers each matching concrete type with the specified lifetime

Samples

You can view more detailed sample by referring to Jinget.CoreDiScanner.Test project. View UnitTests

Sample 1:

Will scan for types from the calling assembly.

_services.Scan(
    s => s.FromCallingAssembly()
        .AddClasses()
        .AsImplementedInterfaces()
        .WithTransientLifetime());

The above code will scan the calling assembly and registers each matching concrete type as all of its implemented interfaces. WithTransientLifetime indicates that the services should have Transient lifetime.

Sample 2:

Will scan for types from the calling assembly.

_services.Scan(
    s => s.FromExecutingAssembly()
        .AddClasses()
        .AsImplementedInterfaces()
        .WithTransientLifetime());

The above code will scan for types from the currently executing assembly, and registers each matching concrete type as all of its implemented interfaces.

Sample 3:

_services.Scan(
    s => s.FromAssembliesOf(typeof(Sample))
        .AddClasses()
        .AsSelfWithInterfaces()
        .WithSingletonLifetime());

The above code will scan the assembly containing the Sample type and registers each matching concrete type as all of its implemented interfaces, by returning an instance of the main type

Sample 4:

_services.Scan(
    s => s.FromAssemblies(typeof(ICustomInterface).Assembly, typeof(ISelector).Assembly)
        .AddClasses()
        .AsImplementedInterfaces()
        .WithTransientLifetime());

The above code will scan for types in each assembly in assemblies, and registers each matching concrete type as all of its implemented interfaces, by returning an instance of the main type


How to install

In order to install Jinget.Core.DiScanner please refer to nuget.org

Contact Me

👨‍💻 Twitter: https://twitter.com/_jinget

📧 Email: farahmandian2011@gmail.com

📣 Instagram: https://www.instagram.com/vahidfarahmandian

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.  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. 
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
8.0.8 78 6 days ago
8.0.7 70 6 days ago
8.0.6 55 6 days ago
8.0.5 58 7 days ago
8.0.4 81 8 days ago
8.0.3 97 9 days ago
8.0.2 89 9 days ago
8.0.1 102 13 days ago
8.0.0 133 a month ago
8.0.0-preview013 180 2 months ago
8.0.0-preview012 86 2 months ago
8.0.0-preview011 88 3 months ago
8.0.0-preview010 94 3 months ago
8.0.0-preview009 88 3 months ago
8.0.0-preview008 99 3 months ago
8.0.0-preview007 125 4 months ago
8.0.0-preview006 102 4 months ago
8.0.0-preview005 78 4 months ago
8.0.0-preview004 76 4 months ago
8.0.0-preview003 80 4 months ago
8.0.0-preview002 81 4 months ago
8.0.0-preview001 83 4 months ago
6.2.23-preview003 76 4 months ago
6.2.23-preview002 77 4 months ago
6.2.22 120 4 months ago
6.2.21 96 4 months ago
6.2.20 105 4 months ago
6.2.19-preview037 83 5 months ago
6.2.19-preview036 87 5 months ago
6.2.19-preview035 92 6 months ago
6.2.19-preview034 95 6 months ago
6.2.19-preview033 98 6 months ago
6.2.19-preview032 97 6 months ago
6.2.19-preview031 101 6 months ago
6.2.19-preview029 99 6 months ago
6.2.19-preview028 113 6 months ago
6.2.19-preview027 112 6 months ago
6.2.19-preview026 124 6 months ago
6.2.19-preview025 118 6 months ago
6.2.19-preview024 124 6 months ago
6.2.19-preview023 112 7 months ago
6.2.19-preview022 108 7 months ago
6.2.19-preview021 96 7 months ago
6.2.19-preview020 103 7 months ago
6.2.19-preview019 96 7 months ago
6.2.19-preview018 80 7 months ago
6.2.19-preview017 63 7 months ago
6.2.19-preview016 78 7 months ago
6.2.19-preview015 78 7 months ago
6.2.19-preview014 78 7 months ago
6.2.19-preview013 117 7 months ago
6.2.19-preview012 115 7 months ago
6.2.19-preview011 111 9 months ago
6.2.19-preview010 117 9 months ago
6.2.19-preview009 103 9 months ago
6.2.19-preview008 111 9 months ago
6.2.19-preview007 107 9 months ago
6.2.19-preview006 97 9 months ago
6.2.19-preview005 104 9 months ago
6.2.19-preview004 97 9 months ago
6.2.19-preview003 101 9 months ago
6.2.19-preview002 100 9 months ago
6.2.19-preview001 104 9 months ago
6.2.18 145 9 months ago
6.2.18-preview020 100 9 months ago
6.2.18-preview019 100 9 months ago
6.2.18-preview018 105 9 months ago
6.2.18-preview017 112 9 months ago
6.2.18-preview016 103 9 months ago
6.2.18-preview015 118 9 months ago
6.2.18-preview014 107 9 months ago
6.2.18-preview013 108 9 months ago
6.2.18-preview012 108 9 months ago
6.2.18-preview011 120 9 months ago
6.2.18-preview010 124 9 months ago
6.2.18-preview009 115 9 months ago
6.2.18-preview008 117 9 months ago
6.2.18-preview007 140 9 months ago
6.2.18-preview006 120 9 months ago
6.2.18-preview005 119 9 months ago
6.2.18-preview004 120 9 months ago
6.2.18-preview003 102 9 months ago
6.2.18-preview002 105 9 months ago
6.2.17 132 9 months ago
6.2.16 137 9 months ago
6.2.15 146 9 months ago
6.2.14 126 9 months ago
6.2.13 138 10 months ago
6.2.12 143 10 months ago
6.2.11 144 10 months ago
6.2.10 140 10 months ago
6.2.9 114 10 months ago
6.2.8 124 10 months ago
6.2.7 108 10 months ago
6.2.6 143 10 months ago
6.2.5 127 4/24/2024
6.2.4 143 2/1/2024
6.2.3 116 2/1/2024
6.2.2 119 1/31/2024
6.2.1 136 1/23/2024
6.2.0 122 1/23/2024
6.2.0-preview013 108 1/19/2024