Is there a way to limit the top lines returned by OrmLite with a Linq expression?

It seems that the OrmLite Select function (predicate) returns everything to the where clause (over the network) and then applies .Take (x).

I need a way to just return TOP x so that the results are faster and use less bandwidth.

Is there a way to limit the TOP of the rows returned by the OrmLite select (using the Linq expression)?

+6
source share
1 answer

Constraint and offset support is available using the Limit() expression, for example:

Take 10 lines

 var rows = db.Select<Table>(q => q.Where(x => x.Name != null).Limit(10)); 

Skip 5 lines, accept 10

 var rows = db.Select<Table>(q => q.Where(x => x.Name != null).Limit(5,10)); 
+7
source

All Articles