Search Results for

    Show / Hide Table of Contents

    Interface ICommandBus

    • Routes Commands to exactly one handler per command type.
    • Designed for UI/Node -> Controller command flow (single receiver).
    • Provides IDisposable registration token for clean unregistration.
    Namespace: Glitch9
    Assembly: Glitch9.dll
    Syntax
    public interface ICommandBus

    Methods

    | Edit this page View Source

    Dispatch<TCommand>(TCommand)

    • Dispatches a command to its handler.
    • Throws if no handler is registered for the command type.
    Declaration
    void Dispatch<TCommand>(TCommand command) where TCommand : ICommand
    Parameters
    Type Name Description
    TCommand command
    Type Parameters
    Name Description
    TCommand
    | Edit this page View Source

    IsRegistered<TCommand>()

    • Returns whether a handler is registered for the command type.
    Declaration
    bool IsRegistered<TCommand>() where TCommand : ICommand
    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    TCommand
    | Edit this page View Source

    Register<TCommand>(ICommandHandler<TCommand>)

    Declaration
    IDisposable Register<TCommand>(ICommandHandler<TCommand> handler) where TCommand : ICommand
    Parameters
    Type Name Description
    ICommandHandler<TCommand> handler
    Returns
    Type Description
    IDisposable
    Type Parameters
    Name Description
    TCommand
    | Edit this page View Source

    Register<TCommand>(Action<TCommand>)

    • Registers a handler for the given command type.
    • Throws if a handler already exists for the command type.
    Declaration
    IDisposable Register<TCommand>(Action<TCommand> handler) where TCommand : ICommand
    Parameters
    Type Name Description
    Action<TCommand> handler
    Returns
    Type Description
    IDisposable
    Type Parameters
    Name Description
    TCommand
    | Edit this page View Source

    TryDispatch<TCommand>(TCommand)

    • Dispatches a command if a handler is registered.
    • Returns false if no handler is registered.
    Declaration
    bool TryDispatch<TCommand>(TCommand command) where TCommand : ICommand
    Parameters
    Type Name Description
    TCommand command
    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    TCommand
    | Edit this page View Source

    Unregister<TCommand>(ICommandHandler<TCommand>)

    Declaration
    void Unregister<TCommand>(ICommandHandler<TCommand> handler) where TCommand : ICommand
    Parameters
    Type Name Description
    ICommandHandler<TCommand> handler
    Type Parameters
    Name Description
    TCommand
    | Edit this page View Source

    Unregister<TCommand>(Action<TCommand>)

    • Unregisters a handler for the given command type (if present).
    Declaration
    void Unregister<TCommand>(Action<TCommand> handler) where TCommand : ICommand
    Parameters
    Type Name Description
    Action<TCommand> handler
    Type Parameters
    Name Description
    TCommand

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation