ZuloOne
English
Sign in
Menu

LinkTable — link table

Updated

What it is#

A many-to-many link between two dictionaries/documents (LT_* table), not tied by its life cycle to either side: a record lives as its pair of references plus its own extra fields (for example IsPrimary). Typical uses are document ancestry (which source order produced which receipt) and multiple master-data links (country ↔ several currencies, with a "primary" flag).

JSON envelope#

<Name>.json, "kind": "LinkTable":

{
  "kind": "LinkTable",
  "object": {
    "caption": { "en": "Country currencies", "ru": "Валюты стран" },
    "metaId": "<GUID LinkTable>", "name": "CountryCurrency", "modelId": "<GUID Model>"
  },
  "properties": [
    {
      "linkTableMetaId": "<GUID LinkTable>",
      "fieldName": "Country",
      "isReference": true, "isRequired": false, "isPrimaryKey": false,
      "displayOrder": 1,
      "caption": { "en": "Country", "ru": "Страна" },
      "metaId": "<GUID Prop>", "name": "Country", "modelId": "<GUID Model>"
    },
    {
      "linkTableMetaId": "<GUID LinkTable>",
      "fieldName": "IsPrimary",
      "baseType": "Boolean", "isReference": false,
      "isRequired": false, "displayOrder": 3,
      "caption": { "en": "Primary", "ru": "Основная" },
      "metaId": "<GUID Prop>", "name": "IsPrimary", "modelId": "<GUID Model>"
    }
  ]
}

isReference: true on a property means a side of the link (a reference to a record on either side), not an EDT field. isPrimaryKey marks composite-key fields when the pair of sides is not unique by itself.

C# base#

Runtime access goes through a dictionary manager or dynamically by name through the link-table manager (Add/Ensure/Get/Delete), or typed through the generated LT_ class: GetRecordsAsync<T>(side, key) / SaveRecordAsync / ReplaceRecordsAsync. ReplaceRecordsAsync makes the side EXACTLY the specified set (it deletes records absent from the passed list).

Events / Chain of Command#

There is no separate handler class. Edits go through the link-table manager from events/services of the link sides, not as an independent object with events.

Example#

CountryCurrency in Common — country ↔ currency, with IsPrimary on the pair.

Was this page helpful?