PostgreSQL · Types · The schema catalog
ArxSchemaCatalog
Definition
- Namespace
ARX.SDK.Services- Package
ARX.SDK
public sealed class ArxSchemaCatalog : IArxSelectionSetCatalogWhat the developer declares about the database: every table's id column and keys, and the selection sets. Build it once at startup and give it to the service: new ArxPgDbService(connectionString, schema). ARX never reads ids, keys or option tables from the database by itself. Immutable and thread-safe.
Properties
IReadOnlyCollection<ArxTableDefinition> Tables { get; }Every declared table, in the order added.
ArxSelectionSetCatalog SelectionSets { get; }The selection sets.
Methods
string ToJson()The catalog's tables as JSON: ids, keys, lookups, display names, columns with their types, and for a preload the reason each table was added and its notes. Reload it with
ArxSchemaCatalog.Create().AddJson(json). Selection sets aren't written: they are code. ARX doesn't write the file: the application decides.static ArxSchemaCatalogBuilder Create()Starts a catalog: declare each table's id, keys, lookups and selection sets, then call Build.
bool TryGetTable(string name, out ArxTableDefinition table)Finds a table by its exact name (table names are case-sensitive).
Parameter Type Description namestringThe table, as the database names it. tableout ArxTableDefinitionThe table's declaration when found; otherwise null. string? ClosestTable(string name)The declared table whose name is closest to
name, for an error that names an undeclared table: the same letters in another case first (table names are case-sensitive), then a name within two edits (acountforaccount). Null when no declared name is that close.Parameter Type Description namestringA table name the catalog doesn't declare. bool TryGetSet(string name, out ArxSelectionSetDefinition set)Gets a selection set by name; false when the catalog has none of that name.
Parameter Type Description namestringThe selection set's name. setout ArxSelectionSetDefinitionThe set when found; otherwise null.
Usage
A line from a verified sample; the full, runnable code is on its page.
var schema = ArxSchemaCatalog.Create()Create one record and get its id, scenario 1
Used in:
- Create one record and get its idCreate
- Create a record that points at another oneCreate
- Catch an error by its codeCreate
- Ids that aren't numbers: text and uuidCreate
- Where to declare: on the entity, or a schema for one call, never bothCreate
- Picklist values checked against the application's catalogCreate
- Register ARX in a DI container and inject itCreate
- Load ids and keys from JSON and validate them at startupCreate
- Write to two databases, each with its own serviceCreate
- Use columns named outside the name rule, through aliasesCreate
- Remember resolved tables, or preload themCreate
- Create many records in one call and get their idsCreateMultiple
- Create many records without reading their idsCreateMultiple
- Update one recordUpdate
- Clear a value, keep the othersUpdate
- Catch a record that doesn't existUpdate
- Find rows by id, by key or by columnsUpdate
- Update many records in one callUpdateMultiple
- Update every row a filter matchesUpdateMultiple
- Delete one recordDelete
- Nothing to delete is not an errorDelete
- Delete by key, by compound key, by columnsDelete
- Delete many records in one callDeleteMultiple
- Delete every row a filter matchesDeleteMultiple
- Retrieve one recordRetrieve
- Choose the columns to readRetrieve
- Find a record by id, key or columnsRetrieve
- Retrieve many records with a queryRetrieveMultiple
- Page through resultsRetrieveMultiple
- Read a viewRetrieveMultiple
- Views in depth: computed criteria, links both ways, declared ids and lookups, column boundariesRetrieveMultiple
- Retrieve on a preloaded schema: lookups found, enums typed, Strict, saved JSONRetrieveMultiple
- The sample application