Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c223a27

Browse files
committed
Support nullable int's for Limit(skip,take), only non-null values have any effect.
1 parent 760f13e commit c223a27

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/ServiceStack.OrmLite/Expressions/SqlExpression.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,25 @@ private void BuildOrderByClauseInternal()
341341
/// </param>
342342
public virtual SqlExpression<T> Limit(int skip, int rows)
343343
{
344-
Rows = rows;
345344
Skip = skip;
345+
Rows = rows;
346+
return this;
347+
}
348+
/// <summary>
349+
/// Set the specified offset and rows for SQL Limit clause where they're not null.
350+
/// </summary>
351+
/// <param name='skip'>
352+
/// Offset of the first row to return. The offset of the initial row is 0
353+
/// </param>
354+
/// <param name='rows'>
355+
/// Number of rows returned by a SELECT statement
356+
/// </param>
357+
public virtual SqlExpression<T> Limit(int? skip, int? rows)
358+
{
359+
if (skip != null)
360+
Skip = skip;
361+
if (rows != null)
362+
Rows = rows;
346363
return this;
347364
}
348365

0 commit comments

Comments
 (0)