Pygmalions.Nebula.Extending 0.2.0

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

// Install Pygmalions.Nebula.Extending as a Cake Tool
#tool nuget:?package=Pygmalions.Nebula.Extending&version=0.2.0                

Nebula Extending

Fundamental library of Pygmalions' Nebula Framework.

This library provides the assemblies filter mechanism which are mostly used for in-assembly auto discovery functions.

Checking all types in all loaded assemblies is very time-consuming. Especially there are many assemblies provided by the language or the third parties which don't have any possibility to contain types which should be auto discovered.

By using this library, the auto discovery functions can ignore most assemblies which are not used as plugins, which means that they don't have types to discover.

Concepts

Plugin Assembly

A plugin, or a plugin assembly, is the plugin which contains types that should enable in-assembly auto discovery on them.

By mark an assembly with the attribute PluginAssembly, it will be auto scanned by PluginRegister.Scanner, and thus it will not be ignored by auto discovery functions which are using Nebula.Extending to filter assemblies.

Transited Plugins

An assembly may also use other assemblies as plugins. If it is used as a plugin by another assembly, then those plugin assemblies will also be used.

Conditional Plugins

By setting the properties ApplyOnReleaseMode and ApplyOnDebugMode, the plugin assemblies can only be used in debug mode, or relase mode.

How to Use

Make An Assembly Discoverable

All libraries in Nebula.Framework use this library to filter assemblies. To auto discovery will always enable on the entrance assembly (which contains the program entrance). Otherwise, mark the assembly with the PluginAssembly attribute in any .cs file outsides the namespace.

[assembly: PluginAssembly]

Filter Assemblies

The PluginRegistry.Scanner provides a lazy global singleton instance to use. It will scan plugin assemblies in loaded assemblies when its instance is firstly visited. Then the result will be cached, but can be manually updated by Update() method.

foreach (var (assemblyName, (assembly, scanned)) in Plugins.Assemblies)
{
    foreach (var type in assembly.GetTypes)
    {
        // Do type discovery here.
    }
}

Remarks

This library is under rapid development, thus its API may be very unstable, DO NOT use it in the production environment, until its version reaches 1.0.0.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Pygmalions.Nebula.Extending:

Package Downloads
Pygmalions.Nebula.Proxying

It provides proxy mechanism and a dynamic proxy generator implemented with Emit.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 992 4/10/2022
0.2.0 1,010 3/26/2022
0.1.0 848 3/25/2022

This library under rapid development, thus its API may be unstable. It is not recommended to use this library in production until the version of this library reaches 1.0.0.