CommandDescriptor<T> record

Namespace Runic.Application.Views · Runic.Application 0.7.0-preview.5

public sealed record CommandDescriptor<T> : IEquatable<CommandDescriptor<T>>

Inherits or implements IEquatable.

Describes one bridged command. Created by generated bridges.

Parameters

Name

The command property name.

Get

Reads the command object from the ViewModel.

ExecuteAsync

Executes a command without a result.

ReadArgument

Decodes the browser argument.

ExecuteResultAsync

Executes a command that produces a result.

EncodeArgument

Encodes the argument for diagnostics and replay checks.

CanExecute

Evaluates whether the command can run with an argument.

Subscribe

Observes changes of the command's executability.

CreateStream

Creates the result stream of a streaming command.

ExecuteStreamAsync

Executes a streaming command.

EncodeFailure

Encodes the value of a RunicFailureException when it is the command's declared failure type, and returns null otherwise. null when the command declares no failure.

Constructors

CommandDescriptor

public CommandDescriptor(string Name, Func<T, object> Get, Func<T, CancellationToken, object?, Task>? ExecuteAsync = null, Func<IBridgeArguments, object?>? ReadArgument = null, Func<T, CancellationToken, object?, Task<BridgeOperationResult>>? ExecuteResultAsync = null, Func<object?, string>? EncodeArgument = null, Func<T, object?, bool>? CanExecute = null, Func<T, Action, IDisposable>? Subscribe = null, Func<BridgeOperationStream>? CreateStream = null, Func<T, BridgeOperationExecution, CancellationToken, object?, Task<BridgeOperationResult>>? ExecuteStreamAsync = null, Func<object, string?>? EncodeFailure = null)

Describes one bridged command. Created by generated bridges.

Parameters

Name

The command property name.

Get

Reads the command object from the ViewModel.

ExecuteAsync

Executes a command without a result.

ReadArgument

Decodes the browser argument.

ExecuteResultAsync

Executes a command that produces a result.

EncodeArgument

Encodes the argument for diagnostics and replay checks.

CanExecute

Evaluates whether the command can run with an argument.

Subscribe

Observes changes of the command's executability.

CreateStream

Creates the result stream of a streaming command.

ExecuteStreamAsync

Executes a streaming command.

EncodeFailure

Encodes the value of a RunicFailureException when it is the command's declared failure type, and returns null otherwise. null when the command declares no failure.

Properties

CanExecute

public Func<T, object?, bool>? CanExecute { get; init; }

Evaluates whether the command can run with an argument.

CreateStream

public Func<BridgeOperationStream>? CreateStream { get; init; }

Creates the result stream of a streaming command.

EncodeArgument

public Func<object?, string>? EncodeArgument { get; init; }

Encodes the argument for diagnostics and replay checks.

EncodeFailure

public Func<object, string?>? EncodeFailure { get; init; }

Encodes the value of a RunicFailureException when it is the command's declared failure type, and returns null otherwise. null when the command declares no failure.

ExecuteAsync

public Func<T, CancellationToken, object?, Task>? ExecuteAsync { get; init; }

Executes a command without a result.

ExecuteResultAsync

public Func<T, CancellationToken, object?, Task<BridgeOperationResult>>? ExecuteResultAsync { get; init; }

Executes a command that produces a result.

ExecuteStreamAsync

public Func<T, BridgeOperationExecution, CancellationToken, object?, Task<BridgeOperationResult>>? ExecuteStreamAsync { get; init; }

Executes a streaming command.

Get

public Func<T, object> Get { get; init; }

Reads the command object from the ViewModel.

Name

public string Name { get; init; }

The command property name.

ReadArgument

public Func<IBridgeArguments, object?>? ReadArgument { get; init; }

Decodes the browser argument.

Subscribe

public Func<T, Action, IDisposable>? Subscribe { get; init; }

Observes changes of the command's executability.