Skip to main content

EntityRuleEngineResult<TEntity>

Namespace: Meshmakers.Octo.Runtime.Contracts.RuleEngine

Represents a result of a rule engine execution.

public record EntityRuleEngineResult<TEntity> : IEquatable<EntityRuleEngineResult<TEntity>>

Type Parameters​

TEntity

Inheritance Object → EntityRuleEngineResult<TEntity>
Implements IEquatable<EntityRuleEngineResult<TEntity>>

Properties​

RtEntitiesToInsert​

Returns a list of entities to create.

public List<TEntity> RtEntitiesToInsert { get; }

Property Value​

List<TEntity>

RtEntitiesToUpdate​

Returns a list of entities to update.

public Dictionary<RtEntityId, TEntity> RtEntitiesToUpdate { get; }

Property Value​

Dictionary<RtEntityId, TEntity>

RtEntitiesToReplace​

Returns a list of entities to replace.

public Dictionary<RtEntityId, TEntity> RtEntitiesToReplace { get; }

Property Value​

Dictionary<RtEntityId, TEntity>

RtEntitiesToDelete​

Returns a list of entities to delete.

public List<RtEntityId> RtEntitiesToDelete { get; }

Property Value​

List<RtEntityId>

UpdateGuards​

Optimistic-concurrency guards keyed by entity id. An entry indicates that the corresponding update in EntityRuleEngineResult<TEntity>.RtEntitiesToUpdate must be applied conditionally — see AttributeNewerThanGuard for semantics. Entities without a guard are updated unconditionally.

public Dictionary<RtEntityId, AttributeNewerThanGuard> UpdateGuards { get; }

Property Value​

Dictionary<RtEntityId, AttributeNewerThanGuard>

RecordArrayItemUpdates​

Atomic updates of single RecordArray items keyed by entity id. An entry belongs to the corresponding update in EntityRuleEngineResult<TEntity>.RtEntitiesToUpdate and is written in the same statement, without reading the stored entity. See RtRecordArrayItemUpdate.

public Dictionary<RtEntityId, IReadOnlyList<RtRecordArrayItemUpdate>> RecordArrayItemUpdates { get; }

Property Value​

Dictionary<RtEntityId, IReadOnlyList<RtRecordArrayItemUpdate>>

ExpectedRtVersions​

Expected stored RtEntity.RtVersion keyed by entity id. An entry belongs to the corresponding update in EntityRuleEngineResult<TEntity>.RtEntitiesToUpdate or replace in EntityRuleEngineResult<TEntity>.RtEntitiesToReplace and is written only if the stored entity still has that version; a mismatch throws RtVersionConflictException. Entities without an entry are written unconditionally.

public Dictionary<RtEntityId, ulong> ExpectedRtVersions { get; }

Property Value​

Dictionary<RtEntityId, UInt64>

Constructors​

EntityRuleEngineResult()​

Creates a new instance of EntityRuleEngineResult<TEntity>.

public EntityRuleEngineResult()

EntityRuleEngineResult(List<TEntity>, Dictionary<RtEntityId, TEntity>, Dictionary<RtEntityId, TEntity>, List<RtEntityId>, Dictionary<RtEntityId, AttributeNewerThanGuard>, Dictionary<RtEntityId, IReadOnlyList<RtRecordArrayItemUpdate>>, Dictionary<RtEntityId, UInt64>)​

Creates a new instance of EntityRuleEngineResult<TEntity>.

public EntityRuleEngineResult(List<TEntity> rtEntitiesToInsert, Dictionary<RtEntityId, TEntity> rtEntitiesToUpdate, Dictionary<RtEntityId, TEntity> rtEntitiesToReplace, List<RtEntityId> rtEntitiesToDelete, Dictionary<RtEntityId, AttributeNewerThanGuard> updateGuards, Dictionary<RtEntityId, IReadOnlyList<RtRecordArrayItemUpdate>> recordArrayItemUpdates, Dictionary<RtEntityId, ulong> expectedRtVersions)

Parameters​

rtEntitiesToInsert List<TEntity>
List of entities to create.

rtEntitiesToUpdate Dictionary<RtEntityId, TEntity>
List of entities to update.

rtEntitiesToReplace Dictionary<RtEntityId, TEntity>
List of entities to replace.

rtEntitiesToDelete List<RtEntityId>
List of entities to delete.

updateGuards Dictionary<RtEntityId, AttributeNewerThanGuard>
Optional optimistic-concurrency guards keyed by entity id. Entries are present only for entries in rtEntitiesToUpdate that were created via EntityUpdateInfo<TEntity>.CreateConditionalUpdate(RtEntityId, TEntity, AttributeNewerThanGuard).

recordArrayItemUpdates Dictionary<RtEntityId, IReadOnlyList<RtRecordArrayItemUpdate>>
Validated and normalised atomic RecordArray item updates keyed by entity id. Entries are present only for entries in rtEntitiesToUpdate whose update info carries item updates.

expectedRtVersions Dictionary<RtEntityId, UInt64>
Expected stored versions keyed by entity id. Entries are present for entries in rtEntitiesToUpdate and rtEntitiesToReplace whose update info carries an expected version.