protected override async Task<SelectedSnapshot> LoadAsync(string persistenceId, SnapshotSelectionCriteria criteria)
{
using (var connection = CreateDbConnection())
{
await connection.OpenAsync();
var sqlCommand = QueryBuilder.SelectSnapshot(persistenceId, criteria.MaxSequenceNr, criteria.MaxTimeStamp);
CompleteCommand(sqlCommand, connection);
var reader = await sqlCommand.ExecuteReaderAsync(_pendingRequestsCancellation.Token);
try
{
return reader.Read() ? QueryMapper.Map(reader) : null;
}
finally
{
reader.Close();
}
}
}