BridgeCollectionDescriptor class

Namespace Runic.Application.Views.Generated in Runic.Application.Views 0.23.0

public sealed class BridgeCollectionDescriptor

Generated, reflection-free metadata for a keyed collection.

Parameters

name

The collection's wire name.

get

Reads the collection from the ViewModel.

writeItem

Writes one row.

key

Reads the wire key of a row.

publishesChanges

Whether the collection publishes indexed changes rather than only full states.

Remarks

The bridge checks the keys of every state and frame it writes. With a null row or a null, empty or duplicate key it withholds the route's state and reports the field and key instead of publishing it; explicit snapshot reads and replies fail. When publishesChanges is false (a ViewModel with validation), the collection only publishes full states, whose keys are still checked.

Constructors

BridgeCollectionDescriptor

public BridgeCollectionDescriptor(string name, Func<object, object?> get, Action<Utf8JsonWriter, object?> writeItem, Func<object?, string> key, bool publishesChanges = true)

Generated, reflection-free metadata for a keyed collection.

Parameters

name

The collection's wire name.

get

Reads the collection from the ViewModel.

writeItem

Writes one row.

key

Reads the wire key of a row.

publishesChanges

Whether the collection publishes indexed changes rather than only full states.

Remarks

The bridge checks the keys of every state and frame it writes. With a null row or a null, empty or duplicate key it withholds the route's state and reports the field and key instead of publishing it; explicit snapshot reads and replies fail. When publishesChanges is false (a ViewModel with validation), the collection only publishes full states, whose keys are still checked.

Properties

FieldPaths

public IReadOnlyList<BridgeFieldPath>? FieldPaths { get; init; }

The paths in a row that accept checked writes with field-paths/1 (its cells), with the generated copy of a row with one cell changed; null when the rows are not editable.

Get

public Func<object, object?> Get { get; }

Reads the collection from the ViewModel.

Key

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

Reads the wire key of a row.

Name

public string Name { get; }

The collection's wire name.

PublishesChanges

public bool PublishesChanges { get; }

Whether the collection publishes indexed changes rather than only full states.

RowConflicts

public RunicRowConflicts RowConflicts { get; init; }

When a cell write is a conflict: per cell (the default) or per row.

UpdateRow

public Action<object, object?, RunicRowEdit>? UpdateRow { get; init; }

Applies an updated row: calls the ViewModel's RunicRowEditorAttribute method with the row's key, the row and the edit. It throws to reject the update.

WriteItem

public Action<Utf8JsonWriter, object?> WriteItem { get; }

Writes one row.