src/fursvp.data/RepositoryDecorators/CachingRepository.cs
/// <summary>
/// Updates the entity's Version property and, if the versions do not conflict, overwrites the existing document in the repository and in the cache.
/// </summary>
/// <param name="entity">The entity to persist to the repository.</param>
/// <returns>An asynchronous <see cref="Task{T}"/>.</returns>
Updates the entity's Version property and, if the versions do not conflict, overwrites the existing document in the repository and in the cache.
Updates the entity ' s Version property and if the versions do not conflict overwrites the existing document in the repository and in the cache .
public async Task Update(T entity)
        {
            var entityInDb = await GetNewerVersionIfExists(entity.Id, entity.Version).ConfigureAwait(false);
            if (entityInDb != null && entityInDb.Version != entity.Version)
            {
                throw new VersionConflictException<T>("Version conflict detected.");
            }
            entity.Version++;
            await Decorated.Update(entity).ConfigureAwait(false);
            CacheCopyOfEntity(entity);
        }
public async Task Update ( T entity ) { var entityInDb = await GetNewerVersionIfExists ( entity . Id , entity . Version ) . ConfigureAwait ( false ) ; if ( entityInDb != null && entityInDb . Version != entity . Version ) { throw new VersionConflictException < T > ( " " ) ; } entity . Version ++ ; await Decorated . Update ( entity ) . ConfigureAwait ( false ) ; CacheCopyOfEntity ( entity ) ; }
Updates the entity's Version property and, if the versions do not conflict, overwrites the existing document in the repository and in the cache.
Updates the entity ' s Version property and if the versions do not conflict overwrites the existing document in the repository and in the cache .
// TODO - it would be nice if this could be made into an atomic operation against Firestore.
An asynchronous .
An asynchronous .
entity
T
The entity to persist to the repository.
The entity to persist to the repository .