Skip to main content

IPreDocumentUpdateValidation<TDocument>

Namespace: Meshmakers.Octo.Runtime.Contracts.Repositories

Checks partial updates before anything of a bulk mutation is written. The IPreDocumentModification<TDocument> pipeline runs on insert and replace only, so a rule that a stored entity must keep (for example the configuration of a number range) is checked here for updates: the validation gets the partial documents (only the attributes the update sets, with RtId and CkTypeId), reads what it needs itself and throws to refuse the whole batch. Atomic record-array item updates (RecordArrayItemUpdates) are not part of the partial documents; a validation of a record-array attribute does not see them.

public interface IPreDocumentUpdateValidation<TDocument>

Type Parameters​

TDocument
The document type

Methods​

RunAsync(IOctoSession, IRepositoryDataSource, IReadOnlyList<TDocument>)​

Validates the partial updates of one bulk mutation; throws to refuse them.

Task RunAsync(IOctoSession session, IRepositoryDataSource repositoryDataSource, IReadOnlyList<TDocument> partialDocuments)

Parameters​

session IOctoSession
Session (and transaction) of the write

repositoryDataSource IRepositoryDataSource
Repository data source to read the stored documents from

partialDocuments IReadOnlyList<TDocument>
The partial documents of the update

Returns​

Task