Table of Contents

Class PluginOptions

Namespace
DotCompute.Plugins.Configuration
Assembly
DotCompute.Plugins.dll

Options for the plugin system. Provides configuration settings for plugin loading, discovery, and management.

public class PluginOptions
Inheritance
PluginOptions
Inherited Members

Remarks

This class centralizes all configuration options for the plugin system, including directory scanning, plugin isolation, concurrency limits, and timeouts.

Properties

EnableHotReload

Gets or sets whether to enable hot reload.

public bool EnableHotReload { get; set; }

Property Value

bool

true to enable hot reload functionality; otherwise, false. Default value is false.

Remarks

When enabled, the plugin system will monitor plugin files for changes and automatically reload them. This feature is useful for development scenarios.

IsInitialized

Gets or sets whether the plugin system is initialized.

public bool IsInitialized { get; set; }

Property Value

bool

true if the plugin system has been initialized; otherwise, false. Default value is false.

Remarks

This property is used internally to track the initialization state of the plugin system. It prevents multiple initialization attempts and ensures proper system state.

IsolatePlugins

Gets or sets whether to load plugins in isolation.

public bool IsolatePlugins { get; set; }

Property Value

bool

true to load plugins in isolated contexts; otherwise, false. Default value is true.

Remarks

When enabled, plugins are loaded in separate AssemblyLoadContext instances, providing better isolation and security. Disabling this may improve performance but reduces security and isolation between plugins.

LoadTimeout

Gets or sets the timeout for plugin loading operations.

public TimeSpan LoadTimeout { get; set; }

Property Value

TimeSpan

The maximum time to wait for a plugin to load. Default value is 30 seconds.

Remarks

If a plugin takes longer than this timeout to load, the loading operation will be cancelled and an error will be reported. This prevents hanging during plugin loading.

MaxConcurrentLoads

Gets or sets the maximum number of concurrent plugin loads.

public int MaxConcurrentLoads { get; set; }

Property Value

int

The maximum number of plugins that can be loaded concurrently. Must be greater than zero. Default value is 4.

Remarks

This setting controls the parallelism of plugin loading operations. Higher values may improve loading performance but consume more system resources.

PluginDirectories

Gets or sets the directories to scan for plugins.

public Collection<string> PluginDirectories { get; }

Property Value

Collection<string>

A collection of directory paths to scan for plugin assemblies. Cannot be null.

Remarks

All directories in this collection will be scanned recursively for plugin assemblies during plugin discovery. This allows for distributed plugin storage across multiple directories.

Plugins

Gets or sets configured plugins.

public Dictionary<string, PluginConfig> Plugins { get; }

Property Value

Dictionary<string, PluginConfig>

A dictionary mapping plugin identifiers to their configuration. Cannot be null.

Remarks

This dictionary contains explicitly configured plugins with their settings. The key is typically the plugin name or identifier, and the value contains all configuration details for that plugin.

PluginsDirectory

Gets or sets the directory to scan for plugins.

public string? PluginsDirectory { get; set; }

Property Value

string

The file system path to scan for plugin assemblies, or null if no directory is configured.

Remarks

This directory is scanned recursively for plugin assemblies during plugin discovery. If null, only explicitly configured plugins will be loaded.

SharedAssemblies

Gets or sets the list of shared assemblies.

public Collection<string> SharedAssemblies { get; }

Property Value

Collection<string>

A collection of assembly names that should be shared across plugin contexts. Cannot be null.

Remarks

These assemblies are loaded in the main application context and shared with all plugin contexts, enabling communication between plugins and the host.