Relatude Help

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, bool, DateTime?): it is cast, not converted.

using Relatude.DB.Datamodels;   // IInnerNodeMeta, NodeConstants

// one value: only the members' group can read the article
db.UpdateMeta(article.Id, nameof(IInnerNodeMeta.ReadAccess), membersGroup.Id);

// several at once
db.UpdateMeta(article.Id, [
    new(nameof(IInnerNodeMeta.EditAccess), NodeConstants.UserGroupAdmins),
    new(nameof(IInnerNodeMeta.ReleaseUtc), (DateTime?)new DateTime(2027, 3, 1, 9, 0, 0, DateTimeKind.Utc)),
    new(nameof(IInnerNodeMeta.ExpireUtc), null!),   // no expiry
]);

// together with other writes, in one transaction
db.CreateTransaction()
  .Update(article)
  .UpdateMeta(article.Id, nameof(IInnerNodeMeta.ReadAccess), NodeConstants.UserGroupEveryone)
  .Execute();
Name Value Notes
ReadAccess, EditViewAccess, EditAccess, PublishAccess Guid: a user group's id, or NodeConstants.UserGroupEveryone, UserGroupMember, UserGroupAdmins Guid.Empty means unset: the type's default applies, else (for read and edit view) the database's DefaultReadAccess.
CollectionId Guid Guid.Empty for none. A query whose context names collections reads only nodes in them.
ReleaseUtc, ExpireUtc DateTime?, in UTC null for none. Queries skip the node outside this window, unless their context reads unpublished nodes (§29).
Deleted bool Soft delete: queries skip the node unless their context includes deleted nodes.
CreatedBy, ChangedBy Guid, a user's id The store does not fill these in.

CultureId and the revision type cannot be written this way, and neither can an unknown name: the call throws. The revision methods change culture and type (§29).

On a node with revisions, a revisionId argument writes that revision's meta. The access groups, the collection and the deleted flag are copied to the other revisions. Without a revisionId, every revision is written. All overloads also take the internal int id, and Transaction has the same methods.