Skip to content

Commit 35c4c0e

Browse files
committed
Future proof limit clause by including the table type, in case we ever add limit clause expressions.
1 parent 8821cac commit 35c4c0e

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

SQLitePCL.pretty.Orm/SqlQuery.Limit.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SQLitePCL.pretty.Orm
88
{
99
public static partial class SqlQuery
1010
{
11-
public sealed class LimitClause : ISqlQuery
11+
public sealed class LimitClause<T> : ISqlQuery
1212
{
1313
private readonly string table;
1414
private readonly string selection;
@@ -32,21 +32,21 @@ internal LimitClause(string table, string selection, Expression where, IReadOnly
3232
/// </summary>
3333
/// <param name="n">The number of elements to return.</param>
3434
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
35-
public LimitClause Take(int n)
35+
public LimitClause<T> Take(int n)
3636
{
3737
Contract.Requires(n >= 0);
38-
return new LimitClause(table, selection, where, ordering, n, offset);
38+
return new LimitClause<T>(table, selection, where, ordering, n, offset);
3939
}
4040

4141
/// <summary>
4242
/// Returns a <see cref="TableQuery&lt;T&gt;"/> that skips a specified number of elements in the result set and then returns the remaining elements.
4343
/// </summary>
4444
/// <param name="n">The number of elements to skip before returning the remaining elements.</param>
4545
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
46-
public LimitClause Skip(int n)
46+
public LimitClause<T> Skip(int n)
4747
{
4848
Contract.Requires(n >= 0);
49-
return new LimitClause(table, selection, where, ordering, limit, n);
49+
return new LimitClause<T>(table, selection, where, ordering, limit, n);
5050
}
5151

5252
public override string ToString()

SQLitePCL.pretty.Orm/SqlQuery.OrderBy.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ public OrderByClause<T> ThenByDescending<TValue>(Expression<Func<T, TValue>> ord
4242
/// </summary>
4343
/// <param name="n">The number of elements to return.</param>
4444
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
45-
public LimitClause Take(int n)
45+
public LimitClause<T> Take(int n)
4646
{
4747
Contract.Requires(n >= 0);
48-
return new LimitClause(table, selection, where, this.ordering, n, null);
48+
return new LimitClause<T>(table, selection, where, this.ordering, n, null);
4949
}
5050

5151
/// <summary>
5252
/// Returns a <see cref="TableQuery&lt;T&gt;"/> that skips a specified number of elements in the result set and then returns the remaining elements.
5353
/// </summary>
5454
/// <param name="n">The number of elements to skip before returning the remaining elements.</param>
5555
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
56-
public LimitClause Skip(int n)
56+
public LimitClause<T> Skip(int n)
5757
{
5858
Contract.Requires(n >= 0);
59-
return new LimitClause(table, selection, where, this.ordering, null, n);
59+
return new LimitClause<T>(table, selection, where, this.ordering, null, n);
6060
}
6161

6262
/// <summary>
@@ -65,7 +65,7 @@ public LimitClause Skip(int n)
6565
/// <returns>The <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
6666
/// <param name="index">Index.</param>
6767
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
68-
public LimitClause ElementAt(int index)
68+
public LimitClause<T> ElementAt(int index)
6969
{
7070
Contract.Requires(index >= 0);
7171
return Skip(index).Take(1);

SQLitePCL.pretty.Orm/SqlQuery.Where.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ private WhereClause<T> Where(LambdaExpression lambda)
9696
/// </summary>
9797
/// <param name="n">The number of elements to return.</param>
9898
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
99-
public LimitClause Take(int n)
99+
public LimitClause<T> Take(int n)
100100
{
101101
Contract.Requires(n >= 0);
102-
return new LimitClause(table, selection, where, new List<Tuple<string, bool>>(), n, null);
102+
return new LimitClause<T>(table, selection, where, new List<Tuple<string, bool>>(), n, null);
103103
}
104104

105105
/// <summary>
106106
/// Returns a <see cref="TableQuery&lt;T&gt;"/> that skips a specified number of elements in the result set and then returns the remaining elements.
107107
/// </summary>
108108
/// <param name="n">The number of elements to skip before returning the remaining elements.</param>
109109
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
110-
public LimitClause Skip(int n)
110+
public LimitClause<T> Skip(int n)
111111
{
112112
Contract.Requires(n >= 0);
113-
return new LimitClause(table, selection, where, new List<Tuple<string, bool>>(), null, n);
113+
return new LimitClause<T>(table, selection, where, new List<Tuple<string, bool>>(), null, n);
114114
}
115115

116116
/// <summary>
@@ -119,7 +119,7 @@ public LimitClause Skip(int n)
119119
/// <returns>The <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
120120
/// <param name="index">Index.</param>
121121
/// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery&lt;T&gt;"/>.</returns>
122-
public LimitClause ElementAt(int index)
122+
public LimitClause<T> ElementAt(int index)
123123
{
124124
Contract.Requires(index >= 0);
125125
return Skip(index).Take(1);

0 commit comments

Comments
 (0)