MongoDB · Types · The schema catalog
ArxTableDefinition
Definition
- Namespace
ARX.SDK.Services- Package
ARX.SDK
public sealed class ArxTableDefinitionA table the developer declared: its id column and its keys. Immutable and thread-safe.
Constructor
No public constructor: create one with:
ArxTableDefinition.Define(string table, ArxIdColumn idColumn, IReadOnlyList<ArxKey>? keys = null)A table definition declared on an entity (
IdColumn,Keys) rather than in a schema catalog. The same rules apply: an id column (orNoIdColumn), and no key twice.Parameter Type Description tablestringThe table. idColumnArxIdColumnIts id column, or ArxIdColumn.NoIdColumn. keysIReadOnlyList<ArxKey>?= nullIts business keys; none by default.
Properties
IReadOnlyDictionary<string, ArxColumnDefinition> Columns { get; }The table's columns and their types, by name (lower case), when the schema was preloaded with data types; empty for a table declared by hand or preloaded keys only. With
Strict, the only columns a call may use.bool HasColumns { get; }True when the columns are known (preloaded with data types).
bool HasAllColumns { get; init; }True when the preload loaded every column of the table (an empty column list), not a chosen few.
string? Reason { get; }Why a preload added this table:
"requested", or"added: referenced by account.primary_contact_id"; null when declared by hand.IReadOnlyList<string> Notes { get; }What a preload left out and why (a column ARX can't name, a key not fully loaded, a reference beyond the depth).
string? VersionColumn { get; init; }The column that holds the record's version (optimistic concurrency), or null. A provider that offers it (capability OptimisticConcurrency) writes 1 on Create when the entity gives none, adds one on every Update, and checks an Update or Delete against the version the entity carries: changed since it was read is ARX2004. A provider that doesn't refuses writes to the table with ARX8001.
bool VersionRequired { get; init; }True when an Update of the table must carry the version it read (
.Version(table, column, required: true)): an update without it is refused with ARX1001 instead of writing unconditioned. False (the default) lets an update without a version through, still adding one to the version so other writers see the change.IReadOnlyDictionary<string, string> Aliases { get; init; }The table's name aliases: attribute name (case-insensitive) to the column's name in the database, for a column whose name isn't a valid ARX name (
first-name,order.total). Code uses the attribute; the provider sends the database name, quoted by its own rules, and reads the column back as the attribute. Only declared names pass: a database name never comes from a call. Empty when none are declared.bool HasAliases { get; }True when the table declares aliases.
IReadOnlyDictionary<string, string> Lookups { get; }The lookup columns: column name (lower case) to the table it refers to. A lookup column reads back as an
ArxEntityReferencewhose id has the referenced table's declared type. Empty when none are declared.ArxDisplayName? DisplayName { get; }How a record of this table is named to a person; null when not declared.
string Name { get; }The table (entity) name, exactly as declared (table names are case-sensitive).
ArxIdColumn IdColumn { get; }The id column, or
NoIdColumn.IReadOnlyList<ArxKey> Keys { get; }The business keys, as declared. Empty when the table declares none.
bool HasId { get; }True unless the table is declared
NoIdColumn.
Methods
bool TryGetDatabaseName(string attribute, out string databaseName)The database name of
attributewhen it is an alias; false for an ordinary name.Parameter Type Description attributestringThe attribute name code uses. databaseNameout stringThe column's name in the database when the attribute has an alias; otherwise null. bool TryGetAttribute(string databaseName, out string attribute)The attribute a database column is read back as, when the column has an alias; false for an ordinary column.
Parameter Type Description databaseNamestringThe column's name in the database. attributeout stringThe attribute name its alias gives it, when it has one; otherwise null. ArxRecordId IdOf(long value)The id of a record of this table from an integer value, with no boxing. For providers reading ids back.
Parameter Type Description valuelongThe id's value. ArxRecordId IdOf(object value)The id of a record of this table from its value, which must have the declared type.
Parameter Type Description valueobjectThe id's value.