-
-
Notifications
You must be signed in to change notification settings - Fork 519
Description
From the Docs:
If you are coming from a Linq background here is a bonus for you. You can use the Skip and Take methods as aliases for Offset and Limit enjoy :)
Coming from Linq I would expect the following query to return all records for authorized = true and zero records if authorized = false.
var query = authorized
? new Query("Items")
: new Query("Items).Take(0);In fact, however, SqlKata generates the same SQL code from both queries:
SELECT
*
FROM
[Items]As stated in the documentation, the Take method is merely an alias for Limit, so 0 is treated as “no limit.” Regarding Limit, this also makes sense from a linguistic point of view: zero limit = no limit. With Take, on the other hand, this is very misleading: take zero ≠ take everything
Changing the Take method to treat 0 as zero would, of course, be a fundamental change and a delicate one as well (and also a breaking change). But at the same time, it would make the API more precise and easier to understand.