MySQL · Types · Entities and values

ArxRecordId

Definition

Namespace
ARX.SDK.Services
Package
ARX.SDK
C#
public sealed class ArxRecordId : IEquatable<ArxRecordId>

The id of one record: the value of its table's id column, of any declared id type. Returned by Create and set on RecordId. None for a table declared NoIdColumn. Immutable; equal when the column and value are equal.

Constructor

No public constructor: create one with:

  • implicit operator ArxRecordId(long value)

    An id given as its value alone, so service.RetrieveAsync("account", 42L) works through IArxDataService too: the service takes the column from the table's declaration. Its Column is empty; use Of to name it.

    Parameter Type Description
    valuelongThe id's value.
  • implicit operator ArxRecordId(int value)

    An int id given as its value alone (see the long conversion).

    Parameter Type Description
    valueintThe id's value.
  • implicit operator ArxRecordId(Guid value)

    A Guid id given as its value alone (see the long conversion).

    Parameter Type Description
    valueGuidThe id's value.
  • implicit operator ArxRecordId?(string? value)

    A text id given as its value alone (see the long conversion); null stays null.

    Parameter Type Description
    valuestring?The id's value.
  • ArxRecordId.Of(string column, object value)

    An id with its column and value, for example to update or delete by id.

    Parameter Type Description
    columnstringThe id column's name.
    valueobjectThe id's value.

Properties

  • static ArxRecordId None { get; }

    No id: what Create returns for a table declared NoIdColumn.

  • string Column { get; }

    The id column's name. Empty for None, and for an id given as its value alone.

  • bool HasValue { get; }

    False for None.

  • object Value { get; }

    The id's value, in the declared type.

Methods

  • long AsInt64()

    The value of an integer id (short, int or long).

  • int AsInt32()

    The value of an integer id as an int.

  • Guid AsGuid()

    The value of a Guid id.

  • string AsString()

    The value of a string id.

  • bool Equals(ArxRecordId? other)

    True when other has an equal value (integers compare by value, whatever their width) and the same id column when both name one, so an id given as a plain value equals the id Create returned. Two ids without a value are equal.

    Parameter Type Description
    otherArxRecordId?The id to compare with, or null.
  • static bool operator ==(ArxRecordId? left, ArxRecordId? right)

    True when the ids are equal (see Equals); two nulls are equal.

    Parameter Type Description
    leftArxRecordId?An id, or null.
    rightArxRecordId?An id, or null.
  • static bool operator !=(ArxRecordId? left, ArxRecordId? right)

    True when the ids differ.

    Parameter Type Description
    leftArxRecordId?An id, or null.
    rightArxRecordId?An id, or null.

Usage

C#

A line from a verified sample; the full, runnable code is on its page.

ArxRecordId id = await service.CreateAsync(entity);

Create one record and get its id, scenario 1

Used in: