Table of Contents

Class PublishedCommandSource

Namespace
OneImlx.Terminal.Dynamics
Assembly
OneImlx.Terminal.dll

The default implementation of ITerminalCommandSource<TContext> that loads terminal commands from assemblies in a published location.

public class PublishedCommandSource : ITerminalCommandSource<PublishedCommandSourceContext>
Inheritance
PublishedCommandSource
Implements
Inherited Members

Remarks

This class is designed to dynamically load assemblies containing terminal commands. It is capable of handling both local and network-based published locations. The dynamic loading of assemblies allows for a modular and extensible design where terminal commands can be updated or extended without modifying the core application.

Security Considerations: Since assemblies are loaded dynamically, it's critical to ensure they are from trusted sources. The class leverages ITerminalCommandSourceChecker<TContext> to validate and verify the integrity and authenticity of the assemblies before loading. Developers should implement robust checking mechanisms in the CheckSourceAsync(TContext) to mitigate risks such as code injection or running untrusted code.

Compatibility Concerns: Care should be taken to ensure compatibility of the dynamically loaded assemblies with the main application, particularly in terms of versioning and dependency management.

Performance Implications: Dynamically loading assemblies can have performance implications, especially when loading from network locations. It's advisable to monitor performance and optimize the loading process.

Constructors

PublishedCommandSource(ITerminalTextHandler, ITerminalCommandSourceAssemblyLoader<PublishedCommandSourceContext>, ITerminalCommandSourceChecker<PublishedCommandSourceContext>, ITerminalCommandStore, IOptions<TerminalOptions>, ILogger<PublishedCommandSource>)

Initializes a new instance.

public PublishedCommandSource(ITerminalTextHandler textHandler, ITerminalCommandSourceAssemblyLoader<PublishedCommandSourceContext> publishedAssembliesLoader, ITerminalCommandSourceChecker<PublishedCommandSourceContext> publishedCommandSourceChecker, ITerminalCommandStore commandStore, IOptions<TerminalOptions> terminalOptions, ILogger<PublishedCommandSource> logger)

Parameters

textHandler ITerminalTextHandler

The text handler.

publishedAssembliesLoader ITerminalCommandSourceAssemblyLoader<PublishedCommandSourceContext>

The published assemblies loader.

publishedCommandSourceChecker ITerminalCommandSourceChecker<PublishedCommandSourceContext>

The terminal source checker.

commandStore ITerminalCommandStore

The mutable command store.

terminalOptions IOptions<TerminalOptions>

The terminal configuration options.

logger ILogger<PublishedCommandSource>

The logger.

Methods

LoadCommandSourceAsync(PublishedCommandSourceContext)

Loads the assemblies from the PublishedAssemblies.

public Task LoadCommandSourceAsync(PublishedCommandSourceContext context)

Parameters

context PublishedCommandSourceContext

Returns

Task

Remarks

The published location can be a local location or a remote location on a network. When loading assemblies dynamically, be aware of security implications and compatibility issues, especially if you're loading third-party or untrusted assemblies. Always validate and verify the assemblies before loading them into your application context. The LoadCommandSourceAsync(PublishedCommandSourceContext) will call CheckSourceAsync(TContext) before it starts loading any assembly.