src/fursvp.data/Firestore/FirestoreRepository.cs
/// <summary>
/// Searches for a newer version of an entity in the database if it exists and returns it if found.
/// </summary>
/// <param name="guid">The globally unique identifier for the entity.</param>
/// <param name="version">The presumed most recent version of the entity document.</param>
/// <returns>The newer version of the entity if it exists. Otherwise, default(T).</returns>
Searches for a newer version of an entity in the database if it exists and returns it if found.
Searches for a newer version of an entity in the database if it exists and returns it if found .
public async Task<T> GetNewerVersionIfExists(Guid guid, int version)
        {
            var snapshotCollection = await Collection
                .WhereEqualTo(new FieldPath("Id"), guid.ToString())
                .WhereGreaterThan(new FieldPath("Version"), version)
                .Limit(1)
                .GetSnapshotAsync().ConfigureAwait(false);
            if (snapshotCollection.Count > 0 && snapshotCollection[0]?.Exists == true)
            {
                return Mapper.FromDictionary(snapshotCollection[0].ToDictionary());
            }
            return default;
        }
public async Task < T > GetNewerVersionIfExists ( Guid guid , int version ) { var snapshotCollection = await Collection . WhereEqualTo ( new FieldPath ( " " ) , guid . ToString ( ) ) . WhereGreaterThan ( new FieldPath ( " " ) , version ) . Limit ( 1 ) . GetSnapshotAsync ( ) . ConfigureAwait ( false ) ; if ( snapshotCollection . Count > 0 && snapshotCollection [ 0 ] ? . Exists == true ) { return Mapper . FromDictionary ( snapshotCollection [ 0 ] . ToDictionary ( ) ) ; } return default ; }
Searches for a newer version of an entity in the database if it exists and returns it if found.
Searches for a newer version of an entity in the database if it exists and returns it if found .
The newer version of the entity if it exists. Otherwise, default(T).
The newer version of the entity if it exists . Otherwise default ( T ) .
guid
Guid
The globally unique identifier for the entity.
The globally unique identifier for the entity .
version
int
The presumed most recent version of the entity document.
The presumed most recent version of the entity document .