Method ReplaceAsync
- Namespace
- IntentSharp.Mapping
- Assembly
- IntentSharp.dll
ReplaceAsync(CompiledMapping, MappingRetiredReason, CompiledMapping, CancellationToken)
In one transaction: retires retiring with reason only if that revision is
still active, and then stores replacement as the next revision with the status Active. When
another writer replaced retiring first, nothing is written and that writer's row is returned;
when the key has no active revision at all, replacement is stored as the active one. Returns the
active row.
public Task<CompiledMapping> ReplaceAsync(CompiledMapping retiring, MappingRetiredReason reason, CompiledMapping replacement, CancellationToken cancellationToken = default)
Parameters
retiringCompiledMappingThe active revision being replaced, by its namespace, key and revision.
reasonMappingRetiredReasonWhy it is retired: a category, step, op and path, never an input value.
replacementCompiledMappingThe row that replaces it.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<CompiledMapping>
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The two rows name different namespaces or keys, or the replacement cannot be stored.