Class ITerminalBuilderExtensions
- Namespace
- OneImlx.Terminal.Extensions
- Assembly
- OneImlx.Terminal.dll
The ITerminalBuilder extension methods.
public static class ITerminalBuilderExtensions
- Inheritance
-
ITerminalBuilderExtensions
- Inherited Members
Methods
AddArgumentChecker<TMapper, TChecker>(ITerminalBuilder)
Adds the IDataTypeMapper<TValue> and IArgumentChecker to the service collection.
public static ITerminalBuilder AddArgumentChecker<TMapper, TChecker>(this ITerminalBuilder builder) where TMapper : class, IDataTypeMapper<Argument> where TChecker : class, IArgumentChecker
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TMapperThe argument mapper type.
TCheckerThe argument checker type.
AddCommandParser<TCommand, TRequest>(ITerminalBuilder)
Adds the ICommandParser to the service collection.
public static ITerminalBuilder AddCommandParser<TCommand, TRequest>(this ITerminalBuilder builder) where TCommand : class, ICommandParser where TRequest : class, ITerminalRequestParser
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TCommandThe command parser type.
TRequestThe terminal request parser type.
AddCommandRouter<TRouter, THandler, TResolver>(ITerminalBuilder)
Adds the ICommandRouter and ICommandHandler to the service collection.
public static ITerminalBuilder AddCommandRouter<TRouter, THandler, TResolver>(this ITerminalBuilder builder) where TRouter : class, ICommandRouter where THandler : class, ICommandHandler where TResolver : class, ICommandResolver
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TRouterTHandlerTResolver
AddCommandStore<TStore>(ITerminalBuilder)
Adds the ITerminalCommandStore to the service collection.
public static ITerminalBuilder AddCommandStore<TStore>(this ITerminalBuilder builder) where TStore : class, ITerminalCommandStore
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TStoreThe command descriptor store type.
AddConfigurationOptions(ITerminalBuilder)
Adds the TerminalOptions to the service collection.
public static ITerminalBuilder AddConfigurationOptions(this ITerminalBuilder builder)
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
AddConsole<TConsole>(ITerminalBuilder)
Adds the ITerminalConsole to the service collection.
public static ITerminalBuilder AddConsole<TConsole>(this ITerminalBuilder builder) where TConsole : class, ITerminalConsole
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TConsole
AddDeclarativeAssembly(ITerminalBuilder, Assembly)
Adds all the IDeclarativeRunner implementations to the service collection.
public static ITerminalBuilder AddDeclarativeAssembly(this ITerminalBuilder builder, Assembly assembly)
Parameters
builderITerminalBuilderThe builder.
assemblyAssemblyThe assembly to inspect.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Remarks
The AddDeclarativeAssembly(ITerminalBuilder, Assembly) reads the target assembly and inspects all the declarative targets using reflection. Reflection may have a performance bottleneck. For more optimized and direct declarative target inspection, use AddDeclarativeRunner<TDeclarativeRunner>(ITerminalBuilder).
AddDeclarativeAssembly(ITerminalBuilder, Type)
Adds all the IDeclarativeRunner implementations to the service collection.
public static ITerminalBuilder AddDeclarativeAssembly(this ITerminalBuilder builder, Type assemblyType)
Parameters
builderITerminalBuilderThe builder.
assemblyTypeTypeThe type whose assembly to inspect and read all the declarative targets.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Remarks
The AddDeclarativeAssembly(ITerminalBuilder, Type) reads the target assembly and inspects all the declarative targets using reflection. Reflection may have a performance bottleneck. For more optimized and direct declarative target inspection, use AddDeclarativeRunner<TDeclarativeRunner>(ITerminalBuilder).
AddDeclarativeAssembly<TType>(ITerminalBuilder)
Adds all the IDeclarativeRunner implementations to the service collection.
public static ITerminalBuilder AddDeclarativeAssembly<TType>(this ITerminalBuilder builder)
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TTypeThe type whose assembly to inspect and read all the declarative targets.
Remarks
The AddDeclarativeAssembly(ITerminalBuilder, Type) reads the target assembly and inspects all the declarative targets using reflection. Reflection may have a performance bottleneck. For more optimized and direct declarative target inspection, use AddDeclarativeRunner<TDeclarativeRunner>(ITerminalBuilder).
AddDeclarativeRunner<TDeclarativeRunner>(ITerminalBuilder)
Adds a IDeclarativeRunner to the service collection.
public static ITerminalBuilder AddDeclarativeRunner<TDeclarativeRunner>(this ITerminalBuilder builder) where TDeclarativeRunner : IDeclarativeRunner
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The AddDeclarativeRunner<TDeclarativeRunner>(ITerminalBuilder) inspects the declarative target type using reflection.
Type Parameters
TDeclarativeRunner
AddDynamics<TContext, TSource, TChecker, TLoader>(ITerminalBuilder)
Adds dynamics services to the terminal builder for loading commands from an external source. This method registers the specified command source, command source checker, and command source assembly loader as singletons in the service collection.
public static ITerminalBuilder AddDynamics<TContext, TSource, TChecker, TLoader>(this ITerminalBuilder builder) where TContext : class where TSource : class, ITerminalCommandSource<TContext> where TChecker : class, ITerminalCommandSourceChecker<TContext> where TLoader : class, ITerminalCommandSourceAssemblyLoader<TContext>
Parameters
builderITerminalBuilderThe terminal builder to which the integration services are added.
Returns
- ITerminalBuilder
The ITerminalBuilder with the added integration services, enabling method chaining.
Type Parameters
TContextThe type of the context used in the command source, checker, and loader. Must be a class.
TSourceThe type of the terminal command source. Must be a class implementing ITerminalCommandSource<TContext>.
TCheckerThe type of the terminal command source checker. Must be a class implementing ITerminalCommandSourceChecker<TContext>.
TLoaderThe type of the terminal command source assembly loader. Must be a class implementing ITerminalCommandSourceAssemblyLoader<TContext>.
AddEventHandler<TEventHandler>(ITerminalBuilder)
Adds the ITerminalEventHandler to the service collection.
public static ITerminalBuilder AddEventHandler<TEventHandler>(this ITerminalBuilder builder) where TEventHandler : class, ITerminalEventHandler
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TEventHandler
AddExceptionHandler<THandler>(ITerminalBuilder)
Adds the ITerminalExceptionHandler to the service collection.
public static ITerminalBuilder AddExceptionHandler<THandler>(this ITerminalBuilder builder) where THandler : class, ITerminalExceptionHandler
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
THandlerThe ITerminalExceptionHandler type.
AddHelpProvider<THelpProvider>(ITerminalBuilder)
Adds the command ITerminalHelpProvider to the service collection.
public static ITerminalBuilder AddHelpProvider<THelpProvider>(this ITerminalBuilder builder) where THelpProvider : class, ITerminalHelpProvider
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
THelpProvider
AddLicensing(ITerminalBuilder)
Adds terminal license handler to the service collection.
public static ITerminalBuilder AddLicensing(this ITerminalBuilder builder)
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
AddOptionChecker<TMapper, TChecker>(ITerminalBuilder)
Adds the IDataTypeMapper<TValue> and IOptionChecker to the service collection.
public static ITerminalBuilder AddOptionChecker<TMapper, TChecker>(this ITerminalBuilder builder) where TMapper : class, IDataTypeMapper<Option> where TChecker : class, IOptionChecker
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TMapperThe option mapper type.
TCheckerThe option checker type.
AddProcessor<TTerminalProcessor>(ITerminalBuilder)
Adds the ITerminalProcessor to the service collection.
public static ITerminalBuilder AddProcessor<TTerminalProcessor>(this ITerminalBuilder builder) where TTerminalProcessor : class, ITerminalProcessor
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TTerminalProcessorThe terminal processor type.
AddTerminalRouterContext<TContext>(ITerminalBuilder, TContext)
Adds the TerminalRouterContext to the service collection.
public static ITerminalBuilder AddTerminalRouterContext<TContext>(this ITerminalBuilder builder, TContext terminalRouterContext) where TContext : TerminalRouterContext
Parameters
builderITerminalBuilderThe builder.
terminalRouterContextTContextThe terminal router context.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TContext
AddTerminalRouter<TRouter, TContext>(ITerminalBuilder)
Adds the ITerminalRouter<TContext> to the service collection.
public static ITerminalBuilder AddTerminalRouter<TRouter, TContext>(this ITerminalBuilder builder) where TRouter : class, ITerminalRouter<TContext> where TContext : TerminalRouterContext
Parameters
builderITerminalBuilderThe builder.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TRouterTContext
AddTextHandler<TTextHandler>(ITerminalBuilder, TTextHandler)
Adds the ITerminalTextHandler to the service collection.
public static ITerminalBuilder AddTextHandler<TTextHandler>(this ITerminalBuilder builder, TTextHandler textHandler) where TTextHandler : class, ITerminalTextHandler
Parameters
builderITerminalBuilderThe builder.
textHandlerTTextHandlerThe text handler.
Returns
- ITerminalBuilder
The configured ITerminalBuilder.
Type Parameters
TTextHandlerThe text handler.
Remarks
AddTextHandler<TTextHandler>(ITerminalBuilder, TTextHandler) requires an instance of
TTextHandler instead of just its type because the terminal application is expected to
operate with a single, consistent instance of ITerminalTextHandler throughout its lifetime. By
passing an instance, it allows the terminal to maintain state or configuration specific to that instance,
ensuring consistent text handling behavior across different parts of the application.
This approach also facilitates more flexible initialization patterns, where the ITerminalTextHandler can be configured or initialized outside of the dependency injection container before being registered. This can be particularly useful when the text handler requires complex setup or depends on settings or services that aren't readily available within the DI context.
DefineCommand<TRunner>(ITerminalBuilder, string, string, string, CommandType, CommandFlags)
Starts a new ICommandBuilder definition with the default CommandChecker. Applications must call the Add() method to add the CommandDescriptor to the service collection.
public static ICommandBuilder DefineCommand<TRunner>(this ITerminalBuilder builder, string id, string name, string description, CommandType commandType, CommandFlags commandFlags) where TRunner : ICommandRunner<CommandRunnerResult>
Parameters
builderITerminalBuilderThe builder.
idstringThe command id.
namestringThe command name.
descriptionstringThe command description.
commandTypeCommandTypeThe command type.
commandFlagsCommandFlagsThe command flags.
Returns
- ICommandBuilder
The configured ITerminalBuilder.
Type Parameters
TRunnerThe command runner type.