RunicRowEditorAttribute class

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

public sealed class RunicRowEditorAttribute : Attribute

Inherits or implements Attribute.

Makes the rows of a RunicCollectionAttribute collection editable from the page, cell by cell: the page writes one cell, such as a line's quantity, and the Bridge calls this method with the row's key and the row with that cell changed.

Remarks

The method takes the row's key and the updated row, such as void UpdateLine(int id, InvoiceLine line), and optionally a RunicRowEdit with the changed cell and the row before the edit, and replaces the row in the collection (Lines[index] = line), recomputes what depends on it and may normalize it. Throw to reject the change; the page keeps its draft and shows the exception's message. The Bridge copies the current row with the one cell changed: a record with with, a sealed class with its copy constructor or Clone(), so members the page does not see, such as a RunicIgnoreAttribute database id, are kept. A row type it cannot copy exactly is error RUNICBRIDGE052.

Each cell is a checked field (field-paths/1): a cell that another writer changed after the page read it is a conflict, not overwritten. The generated {View}Fields.lines.at(key).quantity descriptors bind inputs to the cells, with drafts, conflicts and the cells' validation messages.

Constructors

RunicRowEditorAttribute

public RunicRowEditorAttribute()

Makes the rows of the ViewModel's collection whose row type is the method's second parameter editable.

RunicRowEditorAttribute

public RunicRowEditorAttribute(string collection)

Makes the rows of the named collection property editable.

Parameters

collection

The collection property, such as nameof(Lines).

Properties

Collection

public string? Collection { get; }

The collection property, or null to find it by the row type.

Conflicts

public RunicRowConflicts Conflicts { get; set; }

When a cell write is a conflict: RunicRowConflicts.Cell (the default) when another writer changed the same cell meanwhile, RunicRowConflicts.Row when anything in the row changed.