/// <summary> /// Get the current state of the entity as known to the underlying /// database, or null if there is no corresponding row /// </summary> public async Task <object[]> GetDatabaseSnapshotAsync(object id, IEntityPersister persister, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); EntityKey key = session.GenerateEntityKey(id, persister); object cached; if (entitySnapshotsByKey.TryGetValue(key, out cached)) { return(cached == NoRow ? null : (object[])cached); } else { object[] snapshot = await(persister.GetDatabaseSnapshotAsync(id, session, cancellationToken)).ConfigureAwait(false); entitySnapshotsByKey[key] = snapshot ?? NoRow; return(snapshot); } }