Relatude Help

4 Marker properties

A marker attribute maps a member to a value the store keeps for every node. The member is not a property of its own: the store fills it in when it reads the node, and other attributes on it are ignored. Use each marker at most once per type.

Attribute Member type Maps to
[PublicIdProperty] Guid or string The node's id. A Guid member named Id needs no attribute.
[InternalIdProperty] int, long or string The node's internal id.
[CreatedUtcProperty] DateTime When the node was created.
[ChangedUtcProperty] DateTime When the node's values last changed.
[DisplayNameProperty] string The display name you set with UpdateDisplayName.
[AddressProperty] string The node's address: one URL segment, not the whole path (§18).
public interface IArticle {
    Guid Id { get; set; }

    [StringProperty(Indexed = true, IndexedByWords = true, DisplayName = true)]
    string Title { get; set; }                       // an ordinary property that names the node

    [AddressProperty]    string Address { get; }
    [CreatedUtcProperty] DateTime CreatedUtc { get; }
    [ChangedUtcProperty] DateTime ChangedUtc { get; }
}
  • On an interface, declare marker members getter-only. The store writes these values, not your code, and a { get; set; } marker member stops the store from starting.
  • Set the address with UpdateAddress, in the same transaction as the insert if you like. On a class, you can also set an [AddressProperty] member before you save.
  • Name nodes with DisplayName = true on a property, like Title above. The admin UI, GraphQL and facets show nodes by these properties (§3.1). The [DisplayNameProperty] member and Meta.DisplayName hold a separate name, which stays empty until you call UpdateDisplayName.

Inserting a node together with its address:

var article = db.Create<IArticle>();
article.Title = "Winter Session";

db.CreateTransaction()
  .Insert(article)
  .UpdateAddress(article, "winter-session")
  .Execute();
  • What lives in NodeMeta — Every node carries system data, which a NodeMeta Meta { get; } member reads. Never create or assign a NodeMeta yourself. Change the writable fields with UpdateMeta (Writing meta), and the address and display name with…
  • Writing meta: UpdateMeta — UpdateMeta writes meta fields by name: one name and value, or several pairs in one write. The names are the property names of IInnerNodeMeta, so write them with nameof. Each value must have the field's own type (Guid…
  • Querying by the node's own dates — CreatedUtc and ChangedUtc are indexed for every node of every type. Query them through NodeMeta, whether or not the type maps them to members: