Plumsy 1.1.0
dotnet add package Plumsy --version 1.1.0
NuGet\Install-Package Plumsy -Version 1.1.0
<PackageReference Include="Plumsy" Version="1.1.0" />
paket add Plumsy --version 1.1.0
#r "nuget: Plumsy, 1.1.0"
// Install Plumsy as a Cake Addin #addin nuget:?package=Plumsy&version=1.1.0 // Install Plumsy as a Cake Tool #tool nuget:?package=Plumsy&version=1.1.0
Plumsy
Plugin management library
Plumsy is a library for plugin management in C#. It is capable of inspecting and validating dlls, before loading them into the current AppDomain.
Plumsy offers a set of extensions and callbacks to allow the caller to configure what plugins to load, how to handle plugin dependencies and runtime differences.
Examples
Create an instance of PluginManager
var pluginManager = new PluginManager(pathToPlugins);
Retrieve a list of available plugins
var availablePlugins = pluginManager.GetAvailablePlugins();
Plumsy will call the validators for each of the dlls found in the pathToPlugins
and validate the metadata of those dlls. If the dlls pass the validation, they are marked as available and returned by the above call.
Load plugins into the current AppDomain
var results = pluginManager.LoadPlugins(availablePlugins);
Plumsy will attempt to load the provided list of plugin entries into the current AppDomain. results
is a list of PluginLoadOperation
, the type depending on the result of the load operation.
PluginLoadOperation.Success
contains a reference to the loaded assembly and implies that the plugin has been loaded successfully.PluginLoadOperation.NullEntry
implies that the plugin entry was null.PluginLoadOperation.FileNotFound
implies that the plugin path was not found.PluginLoadOperation.ExceptionEncountered
implies that the plugin failed to load due to an exception. Check the innerException
property for details.PluginLoadOperation.UnexpectedErrorOccurred
implies that an unexpected error occurred. This happens when theAssembly.Load
call succeeds but the returned assembly isnull
.
Setup validators
pluginManager
.WithEnvironmentVersionValidator(environmentVersionValidator)
.WithMetadataValidator(metadataValidator)
.WithTypeDefinitionsValidator(typeDefinitionsValidator);
environmentVersionValidator
is of typeIEnvironmentVersionValidator
. This validator is used to validate theVersion
of the current runtime in comparison to the plugin target runtime.metadataValidator
is of typeIMetadataValidator
. This validator receives a reference to theMetadataReader
and can perform general validations over the plugin.typeDefinitionsValidator
is of typeITypeDefinitionsValidator
. This validator receives a reference to theMetadataReader
as well as a list ofType
s in order to perform validations over the plugin. This is useful when wanting to validate that the plugin contains a specific entry point class of a known type.
Callbacks
pluginManager
.WithAssemblyLoadedCallback(assemblyLoadedCallback);
assemblyLoadedCallback
is of typeIAssemblyLoadedCallback
. This callback is called after an assembly has been loaded into the current AppDomain.
Dependency Resolving
pluginManager
.WithDependencyResolver(dependencyResolver);
dependencyResolver
is of typeIDependencyResolver
. The dependency solver is called when the runtime is unable to find some dependencies of the currently loading plugin. !! Due to the runtime lazily loading types, dependencies might only be resolved when calling specific methods !!
pluginManager
.WithForceLoadDependencies(true|false);
- When forcing the Plumsy to load dependencies, Plumsy will attempt to manually cause JIT-ing of the methods in the loaded assembly. This would in turn cause the runtime to load its dependencies and would trigger
IDependencyResolver.TryResolveDependency
in cases where a dependency is not found. - By default, Plumsy forces dependencies to load on assembly load. If you want instead to lazily load dependencies, call
pluginManager.WithForceLoadDependencies(false)
.
Product | Versions 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. |
-
net6.0
- System.Reflection.Metadata (>= 7.0.2)
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 |
---|---|---|
1.1.0 | 2,116 | 9/15/2023 |