Select Count?

Feb 15, 2011 at 1:13 AM

How to I select count of all object of certain type?

I expected something like db.Query<MyClass>().Count(), or db.Count<MyClass>(Predicate<MyClass> filter = null), even db.Count<MyClass>()...

Unfortunately with no success.

Any help?

Thank you in advance

Coordinator
Feb 15, 2011 at 1:17 AM

Queries always require the class type and key type (when querying keys) or the class type and index types (when querying indexes).

So, for example, if you defined MyClass as a table with an integer key: <MyClass,int>

Then you simply use the same to get the count:

db.Query<MyClass,int>().Count();

You are just missing the key type.