Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.
Daniel Wertheim edited this page Nov 29, 2012 · 7 revisions

Count() : int

Returns the total number of structures in the structure set. As of v11.0.0, you Count has been removed from ISession and is now accessed via Query.

using (var session = Database.BeginSession())
{
    return session.Count<Order>();
}

or

using (var session = Database.BeginSession())
{
    return session.Query<Order>().Count();
}

or when doing single query operation:

return db.UseOnceTo().Query<Order>().Count();

Count(expression) : int

Returns the total number of structures for the expression in the structure set.

using (var session = Database.BeginSession())
{
    return session.Query<Order>().Count(o => o.TotalAmount >= 1000);
}

or when doing single query operation:

return db.UseOnceTo().Query<Order>().Count(o => o.TotalAmount >= 1000);
Clone this wiki locally