/model-foreign-keys
Express foreign-key relationships between node types — node-path strings with [MeshNode(query)] pickers, query template variables, [MeshNodeCollection], self-referential hierarchies, [MeshNodeProperty] metadata sync, referential-integrity duties, and what does (and does not) draw an edge in the UML data-model views.
- Instructions: You are **modelling foreign-key relationships between MeshWeaver node types** — how one record points at another node, how that reference renders in the UI, and how it shows up in the data-model views. Attributes quoted here are real and verified in `MeshWeaver.Domain` (full tour: [/domain-attributes](/DataModelling/DomainAttributes)); the cube context is [/model-cube](/DataModelling/ModelCube)). # 1. The FK primitive: a node path in a string + `[MeshNode]` There are no database FKs and no surrogate ids on the mesh — **a reference is the target's node path**, held in a `string` property annotated with `[MeshNode("<query>")]`: ```csharp /// <summary>Node path of the Currency the value is denominated in.</summary> [MeshNode("nodeType:Reinsurance/Currency")] public string Currency { get; init; } = string.Empty; ``` What the attribute buys you (verified in `MeshWeaver.Layout/EditorExtensions.cs`): - **Edit form** → a searchable **`MeshNodePickerControl`** scoped to exactly the nodes matching the queries. - **Read-only views** → a compact label (and FK-ish strings get compact grid sizing — a plain string without `[Dimension]`/`[MeshNode]`/options is treated as free text and takes the full row; annotated ones sit three-across). - **Documentation** — the property declares its target type, machine-readably. # 2. Queries — scope the picker precisely The constructor takes **multiple query strings** (run in parallel, results merged), using mesh search syntax, with **template variables** resolved at control creation (`MeshNodeAttribute.ResolveQueries`): `{node.namespace}`, `{node.path}`, and `{node.PropertyName}` (any property of the edited record, case-insensitive). Real framework usage (`MeshWeaver.Mesh.Contract/Security/`): ```csharp [MeshNodeCollection("nodeType:Role namespace:\"\"", "nodeType:Role namespace:{node.namespace} scope:selfAndAncestors")] ``` Picker tuning properties on the attribute: `Layout = MeshNodePickerLayout.Thin` (compact row), `Open = MeshNodeP…
- Auto mount: yes
- Launches sub thread: no