EntityUpdateInfo<TEntity>
Namespace: Meshmakers.Octo.Runtime.Contracts
Represents an entity update info.
public class EntityUpdateInfo<TEntity> : IEntityUpdateInfo<TEntity>
Type Parameters
TEntity
Inheritance Object → EntityUpdateInfo<TEntity>
Implements IEntityUpdateInfo<TEntity>
Properties
RtEntity
public TEntity RtEntity { get; }
Property Value
TEntity
RtId
public Nullable<OctoObjectId> RtId { get; }
Property Value
CkTypeId
public RtCkId<CkTypeId> CkTypeId { get; }
Property Value
RtCkId<CkTypeId>
ModOption
MOD option.
public EntityModOptions ModOption { get; }
Property Value
UpdateGuard
public AttributeNewerThanGuard UpdateGuard { get; }
Property Value
Remarks:
Not serialized — the guard is meaningful only in-process at write time, not on the wire. Cross-process consumers should call EntityUpdateInfo<TEntity>.CreateConditionalUpdate(RtEntityId, TEntity, AttributeNewerThanGuard) themselves if they need OCC.
ExpectedRtVersion
public Nullable<ulong> ExpectedRtVersion { get; }
Property Value
Remarks:
Serialized (both Newtonsoft and System.Text.Json) so an expected version survives a hop between processes; omitted from the wire when not set, so the shape of every existing update info is unchanged.
ClearSecretAttributes
public IReadOnlyCollection<string> ClearSecretAttributes { get; }
Property Value
Remarks:
Serialized (both Newtonsoft and System.Text.Json) so the clear list survives a hop between processes; omitted from the wire when not set.
RecordArrayItemUpdates
public IReadOnlyCollection<RtRecordArrayItemUpdate> RecordArrayItemUpdates { get; }
Property Value
IReadOnlyCollection<RtRecordArrayItemUpdate>
Remarks:
Serialized (both Newtonsoft and System.Text.Json); omitted from the wire when not set, so the shape of every existing update info is unchanged.
Methods
GetRtEntityId()
public RtEntityId GetRtEntityId()
Returns
RtEntityId
CreateInsert(RtCkId<CkTypeId>, TEntity)
Creates a new instance of EntityUpdateInfo<TEntity> for insert.
public static EntityUpdateInfo<TEntity> CreateInsert(RtCkId<CkTypeId> ckTypeId, TEntity rtEntity)
Parameters
ckTypeId RtCkId<CkTypeId>
Type identifier of the construction kit
rtEntity TEntity
Runtime entity to insert
Returns
CreateInsert(TEntity)
Creates a new instance of EntityUpdateInfo<TEntity> for insert.
public static EntityUpdateInfo<TEntity> CreateInsert(TEntity rtEntity)
Parameters
rtEntity TEntity
Runtime entity to insert
Returns
CreateDelete(RtEntityId)
Creates a new instance of EntityUpdateInfo<TEntity> for delete.
public static EntityUpdateInfo<TEntity> CreateDelete(RtEntityId rtEntityId)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
Returns
CreateUpdate(RtEntityId, TEntity)
Creates a new instance of EntityUpdateInfo<TEntity> for update.
public static EntityUpdateInfo<TEntity> CreateUpdate(RtEntityId rtEntityId, TEntity rtEntity)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to update
Returns
CreateConditionalUpdate(RtEntityId, TEntity, AttributeNewerThanGuard)
Creates a new instance of EntityUpdateInfo<TEntity> for a
conditional update guarded by updateGuard. The write is
applied only if the persisted value at AttributeNewerThanGuard.AttributePath
is missing, null, or less than or equal to
AttributeNewerThanGuard.NewValue. Otherwise the write is silently
skipped — the caller can detect this via the matched-count returned from the
repository.
public static EntityUpdateInfo<TEntity> CreateConditionalUpdate(RtEntityId rtEntityId, TEntity rtEntity, AttributeNewerThanGuard updateGuard)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to update
updateGuard AttributeNewerThanGuard
Guard that gates the write — see AttributeNewerThanGuard
Returns
CreateUpdate(RtEntityId, TEntity, UInt64)
Creates a new instance of EntityUpdateInfo<TEntity> for an update that is applied only if
the stored entity still has expectedRtVersion (optimistic concurrency, see
EntityUpdateInfo<TEntity>.ExpectedRtVersion). On success the stored version becomes expectedRtVersion + 1;
otherwise the repository throws RtVersionConflictException and writes nothing.
public static EntityUpdateInfo<TEntity> CreateUpdate(RtEntityId rtEntityId, TEntity rtEntity, ulong expectedRtVersion)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to update
expectedRtVersion UInt64
The RtEntity.RtVersion the caller read
Returns
CreateReplace(RtEntityId, TEntity, UInt64)
Creates a new instance of EntityUpdateInfo<TEntity> for a replace that is applied only if
the stored entity still has expectedRtVersion (optimistic concurrency, see
EntityUpdateInfo<TEntity>.ExpectedRtVersion). On success the stored version becomes expectedRtVersion + 1
(the version of rtEntity is set accordingly); otherwise the repository throws
RtVersionConflictException and writes nothing.
public static EntityUpdateInfo<TEntity> CreateReplace(RtEntityId rtEntityId, TEntity rtEntity, ulong expectedRtVersion)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to replace
expectedRtVersion UInt64
The RtEntity.RtVersion the caller read
Returns
CreateUpdate(RtEntityId, TEntity, IEnumerable<String>)
Creates a new instance of EntityUpdateInfo<TEntity> for update that also clears
the listed Secret attributes (see EntityUpdateInfo<TEntity>.ClearSecretAttributes).
public static EntityUpdateInfo<TEntity> CreateUpdate(RtEntityId rtEntityId, TEntity rtEntity, IEnumerable<string> clearSecretAttributes)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to update (may carry no attributes when only clearing)
clearSecretAttributes IEnumerable<String>
Names (PascalCase) of the Secret attributes to clear
Returns
CreateReplace(RtEntityId, TEntity)
Creates a new instance of EntityUpdateInfo<TEntity> for replace.
public static EntityUpdateInfo<TEntity> CreateReplace(RtEntityId rtEntityId, TEntity rtEntity)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to replace
Returns
CreateReplace(RtEntityId, TEntity, IEnumerable<String>)
Creates a new instance of EntityUpdateInfo<TEntity> for replace that also clears
the listed Secret attributes. Without a clear entry a replace keeps a stored
secret the incoming entity omits or sends as "".
public static EntityUpdateInfo<TEntity> CreateReplace(RtEntityId rtEntityId, TEntity rtEntity, IEnumerable<string> clearSecretAttributes)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity to replace
clearSecretAttributes IEnumerable<String>
Names (PascalCase) of the Secret attributes to clear
Returns
CreateRecordArrayItemUpdate(RtEntityId, TEntity, IEnumerable<RtRecordArrayItemUpdate>, IEnumerable<String>)
Creates a new instance of EntityUpdateInfo<TEntity> for update that changes single items of
RecordArray attributes atomically, without reading the stored entity (see
RtRecordArrayItemUpdate). rtEntity carries regular attribute updates
that are written in the same statement; it may carry no attributes when only items are updated.
public static EntityUpdateInfo<TEntity> CreateRecordArrayItemUpdate(RtEntityId rtEntityId, TEntity rtEntity, IEnumerable<RtRecordArrayItemUpdate> recordArrayItemUpdates, IEnumerable<string> clearSecretAttributes)
Parameters
rtEntityId RtEntityId
Runtime entity identifier for runtime id and construction kit type
rtEntity TEntity
Runtime entity with regular attribute updates (may carry no attributes)
recordArrayItemUpdates IEnumerable<RtRecordArrayItemUpdate>
The item updates; at least one
clearSecretAttributes IEnumerable<String>
Names (PascalCase) of Secret attributes to clear in the same statement