RunicViewState<TModel> class

Namespace Runic.Application.Testing in Runic.Application.Testing 0.23.0

public sealed class RunicViewState<TModel> where TModel : class

A generated wire state of a TModel route, read by ViewModel member.

Properties

Fields

public JsonElement? Fields { get; }

The versions of the checked fields, {member: {version}}, or null when the View has none.

this[]

public JsonElement this[string field] { get; }

A wire field by name.

Json

public JsonElement Json { get; }

The wire state, including revision.

PendingValidation

public IReadOnlyList<IReadOnlyList<object>> PendingValidation { get; }

The paths of validation.pending: wire member names (String) and list indexes (Int32), [] for the ViewModel itself. Empty when no validation is in progress.

Revision

public long Revision { get; }

The revision of the state.

Methods

CanExecute

public bool CanExecute(Expression<Func<TModel, object?>> command)

Whether an argument-free command is available (can{Command}).

FieldVersion

public long FieldVersion<TValue>(Expression<Func<TModel, TValue>> property)

The version of a checked field, which a checked write must name as its baseline.

Get

public JsonElement Get<TValue>(Expression<Func<TModel, TValue>> property)

The wire value of a state property.

IsExecuting

public bool IsExecuting(Expression<Func<TModel, object?>> command)

Whether an asynchronous command is running (is{Command}Executing).

IsValidating

public bool IsValidating<TValue>(Expression<Func<TModel, TValue>> property)

Whether the validation of a state property, or of a value below it, is in progress: a validation.pending path starts with the property's wire name (IRunicPendingValidation, validation-pending/1).

Keys

public IReadOnlyList<string> Keys(Expression<Func<TModel, object?>> collection)

The row keys of a RunicCollectionAttribute collection, in order.

Read

public TValue Read<TValue>(Expression<Func<TModel, TValue>> property)

Reads a scalar state property: a string, Boolean, Int32, Int64, double, decimal, GUID, enum or text reference (RunicTextReference or Runic.Translations.TranslationReference), or a nullable one. Use RunicViewState.Get for other values, such as records, collections and content.

Exceptions

NotSupportedException

The property is not a scalar. The message names the property and the call to use instead.

Reference

public PageReference? Reference(Expression<Func<TModel, object?>> property)

The content reference a ViewModel content property presents, or null.

References

public IReadOnlyList<PageReference> References(Expression<Func<TModel, object?>> property)

The content references a ViewModel collection presents.

Regions

public RunicRegionCollectionState Regions(Expression<Func<TModel, object?>> collection)

The regions and selected index of a RunicRegionCollectionAttribute region collection.

Parameters

collection

The region collection property, such as vm => vm.Documents.

ToString

public override string ToString()

Inherits documentation from Object.ToString.