PropertyDescriptor class

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

public sealed class PropertyDescriptor

Describes one bridged ViewModel property. Created by generated bridges.

Constructors

PropertyDescriptor

public PropertyDescriptor(string name, string wireName, Func<object, object?> getter, Action<object, JsonElement>? setter)

Describes a property whose setter reads the value of a set request.

Parameters

name

The .NET property name.

wireName

The member's wire name in state.

getter

Reads the property value.

setter

Writes the property from the request's value, or null for a read-only property. It throws FormatException, JsonException, ArgumentException or OverflowException for a value that is not valid input.

PropertyDescriptor

public PropertyDescriptor(string name, string wireName, Func<object, object?> getter, Action<object, JsonElement>? setter, Func<object, object?> observe)

Describes a property whose value comes from an observed sub-object, such as a navigation region slot.

Parameters

name

The .NET property name.

wireName

The member's wire name in state.

getter

Reads the property's wire value.

setter

Writes the property from the request's value, or null for a read-only property.

observe

Returns the sub-object the Bridge observes for this property. The Bridge subscribes when it is created, again when the ViewModel reports a change of this property or of every property, and before the publication unit that follows a change of another property; it publishes when the sub-object changes. A NavigationRegion publishes when its Current changes and binds the window session as its navigator's presentation; a NavigationSelection publishes when its SelectedIndex changes, and for a PropertyDescriptor.RegionCollection also when its regions or their Current change; another INotifyPropertyChanged publishes on every change.

Properties

AppendOnlyTextField

public string? AppendOnlyTextField { get; init; }

The wire name of a RunicAppendOnlyTextAttribute property whose appended text the Bridge publishes as a frame, or null. PropertyDescriptor.Get returns its String value.

CanWrite

public bool CanWrite { get; }

Whether the browser may write the property.

Name

public string Name { get; }

The .NET property name.

QueryRowWriter

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

Writes one row of a RunicQueryCollection property, whose rows a page reads with query-rows (query-collections/1); null for any other property. PropertyDescriptor.Get returns the collection.

RegionClose

public bool RegionClose { get; init; }

Whether a region request of a PropertyDescriptor.RegionCollection property may close a region.

RegionCollection

public bool RegionCollection { get; init; }

Whether the property is a region collection (RunicRegionCollectionAttribute): its observed sub-object is a NavigationSelection whose regions and their content the Bridge observes, and whose regions the page selects with region requests (region-collections/1).

TextMember

public bool TextMember { get; init; }

Whether the property is a text member: a String state member that frames and set requests may change with text splices on connections that use text-splice/1. PropertyDescriptor.Get returns its String value.

TextSetter

public Action<object, string>? TextSetter { get; init; }

Writes a text member from the value a set request's splice produces, or from a set request's string value; null for a read-only property. It throws like the setter.

WireName

public string WireName { get; }

The member's wire name in state.

Methods

Get

public object? Get(object vm)

Reads the property value from vm.