Zum Hauptinhalt springen

RuntimeRepositoryExtensions

Namespace: Meshmakers.Octo.Runtime.Contracts.Repositories

Lookups on IRuntimeRepository for callers that load an entity by its runtime id in order to use it (execute a persisted query, run a configuration) and must not act on a deleted entity.

public static class RuntimeRepositoryExtensions

Inheritance Object → RuntimeRepositoryExtensions

Remarks:

The default delete (DeleteStrategies) archives an entity - the document stays in its collection with RtState.Archived. Queries over a collection filter archived entities out, but IRuntimeRepository.GetRtEntityByRtIdAsync(IOctoSession, RtEntityId) returns the document whatever its state, and some callers rely on that (restore, history, import). A caller that only checked for null kept executing a deleted persisted query for everyone who knew its rtId. The lookups here treat an archived entity as not found; the semantics of IRuntimeRepository.GetRtEntityByRtIdAsync(IOctoSession, RtEntityId) stay unchanged.

Methods​

GetActiveRtEntityByRtIdAsync<TEntity>(IRuntimeRepository, IOctoSession, OctoObjectId)​

Gets an entity by its runtime id, or null when no entity with the id exists or it has been deleted (RtState.Archived).

public static Task<TEntity> GetActiveRtEntityByRtIdAsync<TEntity>(IRuntimeRepository repository, IOctoSession session, OctoObjectId rtId)

Type Parameters​

TEntity
The type of entity derived from RtEntity

Parameters​

repository IRuntimeRepository
The runtime repository

session IOctoSession
The session object

rtId OctoObjectId
The object id

Returns​

Task<TEntity>
The entity, or null when it does not exist or is archived

GetActiveRtEntityByRtIdAsync(IRuntimeRepository, IOctoSession, RtEntityId)​

Gets an entity by its runtime entity id, or null when no entity with the id exists or it has been deleted (RtState.Archived).

public static Task<RtEntity> GetActiveRtEntityByRtIdAsync(IRuntimeRepository repository, IOctoSession session, RtEntityId rtEntityId)

Parameters​

repository IRuntimeRepository
The runtime repository

session IOctoSession
The session object

rtEntityId RtEntityId
The runtime entity id

Returns​

Task<RtEntity>
The entity, or null when it does not exist or is archived