Class CommandsServiceBuilder
A builder for CommandsService.
Inheritance
Namespace: TehGM.Wolfringo.Commands
Assembly: Wolfringo.Commands.dll
Syntax
public class CommandsServiceBuilder
Constructors
| Improve this Doc View SourceCommandsServiceBuilder()
Creates a new WolfClient builder with default values pre-set.
Declaration
public CommandsServiceBuilder()
CommandsServiceBuilder(IServiceCollection)
Creates a new CommandsService builder with provided services.
Declaration
public CommandsServiceBuilder(IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | Initial services to use. |
Properties
| Improve this Doc View SourceOptions
Options for the client.
Declaration
public CommandsOptions Options { get; set; }
Property Value
Type | Description |
---|---|
CommandsOptions |
Methods
| Improve this Doc View SourceBuild()
Builds a new CommandsService with provided values.
Declaration
public CommandsService Build()
Returns
Type | Description |
---|---|
CommandsService | A new CommandsService instance. |
Build(out IWolfClient, out IServiceProvider)
Builds a new CommandsService with provided values.
Declaration
public CommandsService Build(out IWolfClient client, out IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IWolfClient | client | The WOLF Client that is used by the built CommandsService. |
System.IServiceProvider | services | The built service provider. |
Returns
Type | Description |
---|---|
CommandsService | A new CommandsService instance. |
ConfigureOptions(Action<CommandsOptions>)
Allows configuring options for commands service.
Declaration
public CommandsServiceBuilder ConfigureOptions(Action<CommandsOptions> configure)
Parameters
Type | Name | Description |
---|---|---|
System.Action<CommandsOptions> | configure | Delegate that can be used for options configuration. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithArgumentsConverterProvider(IArgumentConverterProvider)
Sets argument converter provider.
Declaration
public CommandsServiceBuilder WithArgumentsConverterProvider(IArgumentConverterProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IArgumentConverterProvider | provider | The argument converter provider. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithArgumentsConverterProvider<TImplementation>()
Sets argument converter provider.
Declaration
public CommandsServiceBuilder WithArgumentsConverterProvider<TImplementation>()
where TImplementation : class, IArgumentConverterProvider
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of argument converter provider. |
WithArgumentsParser(IArgumentsParser)
Sets arguments parser.
Declaration
public CommandsServiceBuilder WithArgumentsParser(IArgumentsParser parser)
Parameters
Type | Name | Description |
---|---|---|
IArgumentsParser | parser | The arguments parser. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithArgumentsParser<TImplementation>()
Sets arguments parser.
Declaration
public CommandsServiceBuilder WithArgumentsParser<TImplementation>()
where TImplementation : class, IArgumentsParser
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of the arguments parser. |
WithCancellationToken(CancellationToken)
Sets cancellation token that can be used for cancelling all tasks within CommandsService.
Declaration
public CommandsServiceBuilder WithCancellationToken(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | Cancellation token to use. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithCaseSensitivity(Boolean)
Sets whether commands are case-sensitive by default.
Declaration
public CommandsServiceBuilder WithCaseSensitivity(bool caseSensitive)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | caseSensitive | Case sensitivity setting. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithCommandInitializerProvider(ICommandInitializerProvider)
Sets command initializer provider.
Declaration
public CommandsServiceBuilder WithCommandInitializerProvider(ICommandInitializerProvider provider)
Parameters
Type | Name | Description |
---|---|---|
ICommandInitializerProvider | provider | The command initializer provider. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithCommandInitializerProvider<TImplementation>()
Sets command initializer provider.
Declaration
public CommandsServiceBuilder WithCommandInitializerProvider<TImplementation>()
where TImplementation : class, ICommandInitializerProvider
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of the command initializer provider. |
WithCommandsHandlerProvider(ICommandsHandlerProvider)
Sets commands handler provider.
Declaration
public CommandsServiceBuilder WithCommandsHandlerProvider(ICommandsHandlerProvider provider)
Parameters
Type | Name | Description |
---|---|---|
ICommandsHandlerProvider | provider | The commands handler provider. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithCommandsHandlerProvider<TImplementation>()
Sets commands handler provider.
Declaration
public CommandsServiceBuilder WithCommandsHandlerProvider<TImplementation>()
where TImplementation : class, ICommandsHandlerProvider
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of commands handler provider. |
WithCommandsLoader(ICommandsLoader)
Sets commands loader.
Declaration
public CommandsServiceBuilder WithCommandsLoader(ICommandsLoader loader)
Parameters
Type | Name | Description |
---|---|---|
ICommandsLoader | loader | The commands loader. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithCommandsLoader<TImplementation>()
Sets commands loader.
Declaration
public CommandsServiceBuilder WithCommandsLoader<TImplementation>()
where TImplementation : class, ICommandsLoader
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of the commands loader. |
WithDefaultArgumentsConverterProvider()
Switches to default argument converter provider with default options.
Declaration
public CommandsServiceBuilder WithDefaultArgumentsConverterProvider()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultArgumentsConverterProvider(ArgumentConverterProviderOptions)
Switches to default argument converter provider.
Declaration
public CommandsServiceBuilder WithDefaultArgumentsConverterProvider(ArgumentConverterProviderOptions options)
Parameters
Type | Name | Description |
---|---|---|
ArgumentConverterProviderOptions | options | Options for the argument converter provider. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultArgumentsParser()
Switches to default arguments parser with default options.
Declaration
public CommandsServiceBuilder WithDefaultArgumentsParser()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultArgumentsParser(ArgumentsParserOptions)
Switches to default arguments parser.
Declaration
public CommandsServiceBuilder WithDefaultArgumentsParser(ArgumentsParserOptions options)
Parameters
Type | Name | Description |
---|---|---|
ArgumentsParserOptions | options | Options for the default parser. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultCommandInitializerProvider()
Switches to default command initializer provider with default options.
Declaration
public CommandsServiceBuilder WithDefaultCommandInitializerProvider()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultCommandInitializerProvider(CommandInitializerProviderOptions)
Switches to default command initializer provider.
Declaration
public CommandsServiceBuilder WithDefaultCommandInitializerProvider(CommandInitializerProviderOptions options)
Parameters
Type | Name | Description |
---|---|---|
CommandInitializerProviderOptions | options | Options for the command initializer provider. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultCommandsHandlerProvider()
Switches to default commands handler provider.
Declaration
public CommandsServiceBuilder WithDefaultCommandsHandlerProvider()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultCommandsLoader()
Switches to default commands loader.
Declaration
public CommandsServiceBuilder WithDefaultCommandsLoader()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultHelpCommand()
Enables default help command functionality.
Declaration
public CommandsServiceBuilder WithDefaultHelpCommand()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultHelpCommand(Boolean)
Enables or disables default help command functionality.
Declaration
public CommandsServiceBuilder WithDefaultHelpCommand(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enabled | Whether the default help command should be enabled. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithDefaultParameterBuilder()
Switches to default parameter builder.
Declaration
public CommandsServiceBuilder WithDefaultParameterBuilder()
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithLogging(ILogger)
Sets a logger to be used by the CommandsService.
Declaration
public CommandsServiceBuilder WithLogging(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Logging.ILogger | logger | Logger to use. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithLogging(ILoggerFactory)
Sets a logger factory that will be used to create a logger.
Declaration
public CommandsServiceBuilder WithLogging(ILoggerFactory factory)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Logging.ILoggerFactory | factory | Logger factory to use when creating a logger. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithParameterBuilder(IParameterBuilder)
Sets parameter builder.
Declaration
public CommandsServiceBuilder WithParameterBuilder(IParameterBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
IParameterBuilder | builder | The parameter builder. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithParameterBuilder<TImplementation>()
Sets parameter builder.
Declaration
public CommandsServiceBuilder WithParameterBuilder<TImplementation>()
where TImplementation : class, IParameterBuilder
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of the parameter builder. |
WithPrefix(String)
Sets the default prefix for commands.
Declaration
public CommandsServiceBuilder WithPrefix(string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | Prefix value. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithPrefixRequirement(PrefixRequirement)
Sets default prefix requirement for commands.
Declaration
public CommandsServiceBuilder WithPrefixRequirement(PrefixRequirement requirePrefix)
Parameters
Type | Name | Description |
---|---|---|
PrefixRequirement | requirePrefix | Prefix requirement. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithScopedService<TService>(Func<IServiceProvider, TService>)
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithScopedService<TService>(Func<IServiceProvider, TService> factory)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.IServiceProvider, TService> | factory | Delegate that will be invoked when the service is resolved. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
WithScopedService<TService, TImplementation>()
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithScopedService<TService, TImplementation>()
where TService : class where TImplementation : class, TService
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
TImplementation | Implementation type of the service |
WithSingletonService<TService>(TService)
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithSingletonService<TService>(TService service)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
TService | service | The service instance. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
WithSingletonService<TService>(Func<IServiceProvider, TService>)
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithSingletonService<TService>(Func<IServiceProvider, TService> factory)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.IServiceProvider, TService> | factory | Delegate that will be invoked when the service is resolved. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
WithSingletonService<TService, TImplementation>()
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithSingletonService<TService, TImplementation>()
where TService : class where TImplementation : class, TService
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
TImplementation | Implementation type of the service |
WithTransientService<TService>(Func<IServiceProvider, TService>)
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithTransientService<TService>(Func<IServiceProvider, TService> factory)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.IServiceProvider, TService> | factory | Delegate that will be invoked when the service is resolved. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
WithTransientService<TService, TImplementation>()
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public CommandsServiceBuilder WithTransientService<TService, TImplementation>()
where TService : class where TImplementation : class, TService
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
TImplementation | Implementation type of the service |
WithWolfClient(Action<WolfClientBuilder>)
Sets WOLF client to use with the CommandsService.
Declaration
public CommandsServiceBuilder WithWolfClient(Action<WolfClientBuilder> clientBuilder)
Parameters
Type | Name | Description |
---|---|---|
System.Action<WolfClientBuilder> | clientBuilder | A delegate that allows configuring the WolfClient before creation. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Remarks
This method allows you configure the client using WolfClientBuilder.
WithWolfClient(IWolfClient)
Sets WOLF client to use with the CommandsService.
Declaration
public CommandsServiceBuilder WithWolfClient(IWolfClient client)
Parameters
Type | Name | Description |
---|---|---|
IWolfClient | client | The WOLF client. |
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
WithWolfClient<TImplementation>()
Sets WOLF client to use with the CommandsService.
Declaration
public CommandsServiceBuilder WithWolfClient<TImplementation>()
where TImplementation : class, IWolfClient
Returns
Type | Description |
---|---|
CommandsServiceBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Implementation type of the WOLF client. |
Events
| Improve this Doc View SourceBuilding
Invoked when the builder is about to build a new instance of CommandsService.
Declaration
public event Action<IServiceCollection> Building
Event Type
Type | Description |
---|---|
System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> |
Built
Invoked when the builder has finished building a new instance of CommandsService.
Declaration
public event Action<CommandsService, IServiceProvider> Built
Event Type
Type | Description |
---|---|
System.Action<CommandsService, System.IServiceProvider> |