MongoDB · Types · Entities and values
ArxEntityReference
Definition
- Namespace
ARX.SDK.Services- Package
ARX.SDK
public class ArxEntityReferenceA lookup: a reference to a record of another table, by that table's name and the record's id. Written to a lookup column as the id; the table name tells ARX which table the id belongs to, so a schema can check it.
Constructor
ArxEntityReference()An empty reference; set its table and id.
ArxEntityReference(string entityName, long id, string? name = null)A reference by an integer id (short, int and long all fit).
Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. idlongThe referenced record's integer id. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it. ArxEntityReference(string entityName, Guid id, string? name = null)A reference by a uuid id.
Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. idGuidThe referenced record's uuid id. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it. ArxEntityReference(string entityName, string id, string? name = null)A reference by a text id (a country code, a SKU).
Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. idstringThe referenced record's text id. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it. ArxEntityReference(string entityName, decimal id, string? name = null)A reference by a decimal id.
Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. iddecimalThe referenced record's decimal id. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it. ArxEntityReference(string entityName, DateOnly id, string? name = null)A reference by a date id.
Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. idDateOnlyThe referenced record's date id. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it. ArxEntityReference(string entityName, DateTime id, string? name = null)A reference by a timestamp id.
Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. idDateTimeThe referenced record's timestamp id. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it. ArxEntityReference(string entityName, ArxRecordId id, string? name = null)A reference by the id Create returned (
await service.CreateAsync(account)), of any type.Parameter Type Description entityNamestringThe referenced table: the table the id belongs to. idArxRecordIdThe id CreateAsync returned for the referenced record, of any id type. namestring?= nullIts display name, if you have it; optional, ARX doesn't write it.
Properties
ArxRecordId? RecordId { get; }The referenced record's id, of any supported type; null when none was given. This is what Create writes to the lookup column.
None(a record of a table with no id column) can't be referenced.long Id { get; set; }Obsolete. Id is only an integer id: 0 for a Guid or text id. Use RecordId (RecordId.Value, AsInt64(), AsGuid(), AsString()).The referenced record's id when it's an integer; 0 otherwise (a Guid or text id reads as 0). Setting it sets
RecordId. UseRecordId, which holds an id of any type.Guid Guid { get; set; }Obsolete. Guid is only a Guid id: Guid.Empty for an integer or text id. Use RecordId (RecordId.Value, AsGuid()).The referenced record's id when it's a Guid;
Guid.Emptyotherwise. Setting it setsRecordId. UseRecordId, which holds an id of any type.string EntityName { get; set; }The referenced table: checked against the schema when there is one (it must be declared, with an id of the reference's type).
string? Name { get; set; }The referenced record's display name, if known. Not written by Create.
Usage
A line from a verified sample; the full, runnable code is on its page.
contact["account_id"] = new ArxEntityReference("account", accountId);Create a record that refers to another, scenario 1
Used in:
- Create a record that refers to anotherCreate
- Create in an ARX transactionCreate
- Read an account with its contactsRetrieveMultiple
Notes
The id can be of any supported id type: short, int, long, decimal, string, Guid, DateOnly or DateTime, or the ArxRecordId that Create returned. Every constructor takes the table name first, then the id, then an optional display name.