in ServiceStack OrmLite v3 you could do:
var rows = db.Select<Employee>().Limit(10));
Or:
var rows = db.Select<Employee>().Limit(5, 10)); // skips 5 then takes 10
However I cannot find these methods any longer in v4.
I suppose I can do the following instead:
var rows = db.SelectLazy<Employee>().Take(10);
However how can I do a db.Select
(not having to write direct SQL) which will translate to (in SQLite for example):
SELECT * FROM Employee LIMIT 10;
Also, is it possible to write an equivalent query for the below (again without having to write direct SQL)?
SELECT * FROM Employee ORDER BY Age;
Thanks.
I can see the
OrderBy
/OrderByDescending
in the documentation, it looks like:This might help with the
Limit
issue ServiceStack.OrmLite: Where is the method to write custom SQL and get result set back?In ServiceStack.OrmLite v4, Limit() seems to only be available as an extension of
SqlExpression<T>
. To build a query:I hope this helps someone out. It took me a few hours of Googling.