public async Task RowCountAsync() { await(SetupPagingDataAsync()); using (ISession s = OpenSession()) { IQueryOver <Person> query = s.QueryOver <Person>() .JoinQueryOver(p => p.Children) .OrderBy(c => c.Age).Desc .Skip(2) .Take(1); IList <Person> results = await(query.ListAsync()); int rowCount = await(query.RowCountAsync()); object bigRowCount = await(query.RowCountInt64Async()); Assert.That(results.Count, Is.EqualTo(1)); Assert.That(results[0].Name, Is.EqualTo("Name 3")); Assert.That(rowCount, Is.EqualTo(4)); Assert.That(bigRowCount, Is.TypeOf <long>()); Assert.That(bigRowCount, Is.EqualTo(4)); } }
public static Task <int> CountAsync <T>(IQueryOver <T> queryOver) => queryOver.RowCountAsync();