Jinget.Core.DiScanner 6.2.19-preview037

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.19-preview037
                    
NuGet\Install-Package Jinget.Core.DiScanner -Version 6.2.19-preview037
                    
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.19-preview037" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jinget.Core.DiScanner" Version="6.2.19-preview037" />
                    
Directory.Packages.props
<PackageReference Include="Jinget.Core.DiScanner" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Jinget.Core.DiScanner --version 6.2.19-preview037
                    
#r "nuget: Jinget.Core.DiScanner, 6.2.19-preview037"
                    
#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.
#addin nuget:?package=Jinget.Core.DiScanner&version=6.2.19-preview037&prerelease
                    
Install Jinget.Core.DiScanner as a Cake Addin
#tool nuget:?package=Jinget.Core.DiScanner&version=6.2.19-preview037&prerelease
                    
Install Jinget.Core.DiScanner as a Cake Tool

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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.26 13 6/21/2025
8.0.25 135 6/15/2025
8.0.25-preview001 131 6/15/2025
8.0.24 114 5/31/2025
8.0.23 141 5/28/2025
8.0.23-preview001 131 5/28/2025
8.0.22 146 5/25/2025
8.0.21 146 5/11/2025
8.0.20 128 5/11/2025
8.0.19 133 5/11/2025
8.0.18 177 4/21/2025
8.0.17 163 4/21/2025
8.0.16 93 4/19/2025
8.0.15 224 4/13/2025
8.0.14 174 4/7/2025
8.0.13 163 4/7/2025
8.0.12 100 4/5/2025
8.0.11 200 3/9/2025
8.0.10 175 3/9/2025
8.0.9 174 3/9/2025
8.0.8 151 2/27/2025
8.0.7 130 2/27/2025
8.0.6 111 2/27/2025
8.0.5 114 2/26/2025
8.0.4 98 2/25/2025
8.0.3 112 2/24/2025
8.0.2 105 2/24/2025
8.0.1 120 2/20/2025
8.0.0 148 1/22/2025
8.0.0-preview013 192 12/19/2024
8.0.0-preview012 96 12/19/2024
8.0.0-preview011 98 12/17/2024
8.0.0-preview010 109 12/16/2024
8.0.0-preview009 103 12/15/2024
8.0.0-preview008 114 11/25/2024
8.0.0-preview007 135 11/11/2024
8.0.0-preview006 113 11/2/2024
8.0.0-preview005 89 11/2/2024
8.0.0-preview004 86 11/1/2024
8.0.0-preview003 91 11/1/2024
8.0.0-preview002 93 11/1/2024
8.0.0-preview001 92 11/1/2024
6.2.23-preview003 85 10/31/2024
6.2.23-preview002 86 10/31/2024
6.2.22 131 10/26/2024
6.2.21 110 10/26/2024
6.2.20 116 10/26/2024
6.2.19-preview037 94 10/14/2024
6.2.19-preview036 100 9/30/2024
6.2.19-preview035 104 9/10/2024
6.2.19-preview034 103 9/9/2024
6.2.19-preview033 109 9/1/2024
6.2.19-preview032 114 9/1/2024
6.2.19-preview031 114 8/31/2024
6.2.19-preview029 110 8/26/2024
6.2.19-preview028 123 8/26/2024
6.2.19-preview027 122 8/26/2024
6.2.19-preview026 134 8/21/2024
6.2.19-preview025 128 8/21/2024
6.2.19-preview024 137 8/19/2024
6.2.19-preview023 127 8/8/2024
6.2.19-preview022 119 8/8/2024
6.2.19-preview021 109 8/5/2024
6.2.19-preview020 112 8/5/2024
6.2.19-preview019 107 8/5/2024
6.2.19-preview018 93 8/3/2024
6.2.19-preview017 75 7/30/2024
6.2.19-preview016 93 7/29/2024
6.2.19-preview015 90 7/29/2024
6.2.19-preview014 90 7/26/2024
6.2.19-preview013 125 7/20/2024
6.2.19-preview012 126 7/20/2024
6.2.19-preview011 121 6/15/2024
6.2.19-preview010 127 6/14/2024
6.2.19-preview009 111 6/14/2024
6.2.19-preview008 121 6/13/2024
6.2.19-preview007 115 6/13/2024
6.2.19-preview006 106 6/13/2024
6.2.19-preview005 115 6/13/2024
6.2.19-preview004 105 6/13/2024
6.2.19-preview003 113 6/11/2024
6.2.19-preview002 109 6/8/2024
6.2.19-preview001 115 6/8/2024
6.2.18 156 6/6/2024
6.2.18-preview020 111 6/6/2024
6.2.18-preview019 111 6/6/2024
6.2.18-preview018 115 6/6/2024
6.2.18-preview017 123 6/2/2024
6.2.18-preview016 113 6/1/2024
6.2.18-preview015 128 5/28/2024
6.2.18-preview014 115 5/28/2024
6.2.18-preview013 123 5/28/2024
6.2.18-preview012 116 5/28/2024
6.2.18-preview011 131 5/26/2024
6.2.18-preview010 133 5/26/2024
6.2.18-preview009 125 5/26/2024
6.2.18-preview008 128 5/26/2024
6.2.18-preview007 149 5/22/2024
6.2.18-preview006 130 5/22/2024
6.2.18-preview005 132 5/19/2024
6.2.18-preview004 131 5/19/2024
6.2.18-preview003 111 5/19/2024
6.2.18-preview002 115 5/19/2024
6.2.17 144 5/19/2024
6.2.16 152 5/18/2024
6.2.15 160 5/18/2024
6.2.14 138 5/18/2024
6.2.13 161 5/17/2024
6.2.12 151 5/17/2024
6.2.11 155 5/17/2024
6.2.10 150 5/17/2024
6.2.9 124 5/12/2024
6.2.8 136 5/9/2024
6.2.7 121 5/9/2024
6.2.6 153 5/7/2024
6.2.5 136 4/24/2024
6.2.4 154 2/1/2024
6.2.3 126 2/1/2024
6.2.2 129 1/31/2024
6.2.1 150 1/23/2024
6.2.0 134 1/23/2024
6.2.0-preview013 119 1/19/2024