سؤال

It seems like OrmLite Select(predicate) function it brings back everything in the where clause (across the network) and then applies the .Take(x) on top of that.

I need a way to only bring back the TOP x so the results are faster and use less bandwidth.

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

هل كانت مفيدة؟

المحلول

Limit and Offset support is available using the Limit() expression, e.g::

Take 10 Rows

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

Skip 5 Rows, Take 10

var rows = db.Select<Table>(q => q.Where(x => x.Name != null).Limit(5,10));
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top