Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class HostedCommandsService

    A wrapper for CommandsService designed to use with .NET Core Host.

    Inheritance
    System.Object
    HostedCommandsService
    Implements
    ICommandsService
    Microsoft.Extensions.Hosting.IHostedService
    System.IDisposable
    Namespace: TehGM.Wolfringo.Hosting.Commands
    Assembly: Wolfringo.Hosting.dll
    Syntax
    public class HostedCommandsService : ICommandsService, IHostedService, IDisposable
    Remarks

    This wrapper uses CommandsService internally, and delegates all method calls and events.

    This class supports configuration changes by using Microsoft.Extensions.Options.IOptionsMonitor<TOptions>. Whenever settings are changed, existing commands service is disposed, and a new one is constructed.

    Constructors

    | Improve this Doc View Source

    HostedCommandsService(IOptionsMonitor<CommandsOptions>, IServiceProvider, ILogger<HostedCommandsService>, IApplicationLifetime)

    Creates a new hosted commands service.

    Declaration
    public HostedCommandsService(IOptionsMonitor<CommandsOptions> options, IServiceProvider services, ILogger<HostedCommandsService> log, IApplicationLifetime hostLifetime)
    Parameters
    Type Name Description
    Microsoft.Extensions.Options.IOptionsMonitor<CommandsOptions> options

    Commands options that will be used as default when running a command.

    System.IServiceProvider services

    Services provider that will be used by all commands.

    Microsoft.Extensions.Logging.ILogger<HostedCommandsService> log

    Logger used by hosted commands service.

    Microsoft.AspNetCore.Hosting.IApplicationLifetime hostLifetime

    Host lifetime that will be used to dispose service when application is exiting.

    Properties

    | Improve this Doc View Source

    Commands

    Descriptors of all commands loaded to this commands service.

    Declaration
    public IEnumerable<ICommandInstanceDescriptor> Commands { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ICommandInstanceDescriptor>

    Methods

    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()

    Explicit Interface Implementations

    | Improve this Doc View Source

    IHostedService.StartAsync(CancellationToken)

    Declaration
    async Task IHostedService.StartAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task
    | Improve this Doc View Source

    IHostedService.StopAsync(CancellationToken)

    Declaration
    Task IHostedService.StopAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task
    | Improve this Doc View Source

    ICommandsService.ExecuteAsync(ICommandContext, CancellationToken)

    Executes commands against a command context.

    Declaration
    Task<ICommandResult> ICommandsService.ExecuteAsync(ICommandContext context, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    ICommandContext context

    Context to execute commands with.

    System.Threading.CancellationToken cancellationToken

    Cancellation token to cancel execution with.

    Returns
    Type Description
    System.Threading.Tasks.Task<ICommandResult>

    Result of the execution.

    | Improve this Doc View Source

    ICommandsService.StartAsync(CancellationToken)

    Starts the Command Service.

    Declaration
    async Task ICommandsService.StartAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken

    Cancellation token to cancel loading with.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Implements

    ICommandsService
    Microsoft.Extensions.Hosting.IHostedService
    System.IDisposable

    See Also

    CommandsService
    ICommandsService