public sealed record CommandDescriptor<T> : IEquatable<CommandDescriptor<T>> Describes one bridged command. Created by generated bridges.
Parameters
NameThe command property name.
GetReads the command object from the ViewModel.
ExecuteAsyncExecutes a command without a result.
ReadArgumentDecodes the browser argument.
ExecuteResultAsyncExecutes a command that produces a result.
EncodeArgumentEncodes the argument for diagnostics and replay checks.
CanExecuteEvaluates whether the command can run with an argument.
SubscribeObserves changes of the command's executability.
CreateStreamCreates the result stream of a streaming command.
ExecuteStreamAsyncExecutes a streaming command.
EncodeFailureEncodes the value of a
RunicFailureExceptionwhen it is the command's declared failure type, and returnsnullotherwise.nullwhen 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
NameThe command property name.
GetReads the command object from the ViewModel.
ExecuteAsyncExecutes a command without a result.
ReadArgumentDecodes the browser argument.
ExecuteResultAsyncExecutes a command that produces a result.
EncodeArgumentEncodes the argument for diagnostics and replay checks.
CanExecuteEvaluates whether the command can run with an argument.
SubscribeObserves changes of the command's executability.
CreateStreamCreates the result stream of a streaming command.
ExecuteStreamAsyncExecutes a streaming command.
EncodeFailureEncodes the value of a
RunicFailureExceptionwhen it is the command's declared failure type, and returnsnullotherwise.nullwhen 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.
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.