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

Commit c3a318c

Browse files
committed
Change include to accept IEnumerable<string> and expose OnlyFields on SqlExpression
1 parent 3ce478c commit c3a318c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/ServiceStack.OrmLite/Expressions/ReadExpressionCommandExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,24 @@ internal static long RowCount(this IDbCommand dbCmd, string sql)
139139
return dbCmd.Scalar<long>(dbCmd.GetDialectProvider().ToRowCountStatement(sql));
140140
}
141141

142-
internal static List<T> LoadSelect<T>(this IDbCommand dbCmd, Func<SqlExpression<T>, SqlExpression<T>> expression, string[] include = null)
142+
internal static List<T> LoadSelect<T>(this IDbCommand dbCmd, Func<SqlExpression<T>, SqlExpression<T>> expression, IEnumerable<string> include = null)
143143
{
144144
var expr = dbCmd.GetDialectProvider().SqlExpression<T>();
145145
expr = expression(expr);
146146
return dbCmd.LoadListWithReferences<T, T>(expr, include);
147147
}
148148

149-
internal static List<T> LoadSelect<T>(this IDbCommand dbCmd, SqlExpression<T> expression = null, string[] include = null)
149+
internal static List<T> LoadSelect<T>(this IDbCommand dbCmd, SqlExpression<T> expression = null, IEnumerable<string> include = null)
150150
{
151151
return dbCmd.LoadListWithReferences<T, T>(expression, include);
152152
}
153153

154-
internal static List<Into> LoadSelect<Into, From>(this IDbCommand dbCmd, SqlExpression<From> expression, string[] include = null)
154+
internal static List<Into> LoadSelect<Into, From>(this IDbCommand dbCmd, SqlExpression<From> expression, IEnumerable<string> include = null)
155155
{
156156
return dbCmd.LoadListWithReferences<Into, From>(expression, include);
157157
}
158158

159-
internal static List<T> LoadSelect<T>(this IDbCommand dbCmd, Expression<Func<T, bool>> predicate, string[] include = null)
159+
internal static List<T> LoadSelect<T>(this IDbCommand dbCmd, Expression<Func<T, bool>> predicate, IEnumerable<string> include = null)
160160
{
161161
var expr = dbCmd.GetDialectProvider().SqlExpression<T>().Where(predicate);
162162
return dbCmd.LoadListWithReferences<T, T>(expr, include);

src/ServiceStack.OrmLite/Expressions/SqlExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public abstract partial class SqlExpression<T> : ISqlExpression, IHasUntypedSqlE
2121
private string groupBy = string.Empty;
2222
private string havingExpression;
2323
private string orderBy = string.Empty;
24-
protected internal HashSet<string> OnlyFields { get; set; }
24+
public HashSet<string> OnlyFields { get; protected set; }
2525

2626
public List<string> UpdateFields { get; set; }
2727
public List<string> InsertFields { get; set; }

src/ServiceStack.OrmLite/OrmLiteReadExpressionsApi.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public static long RowCount(this IDbConnection dbConn, string sql)
270270
/// Returns results with references from using a LINQ Expression. E.g:
271271
/// <para>db.LoadSelect&lt;Person&gt;(x =&gt; x.Age &gt; 40)</para>
272272
/// </summary>
273-
public static List<T> LoadSelect<T>(this IDbConnection dbConn, Expression<Func<T, bool>> predicate, string[] include = null)
273+
public static List<T> LoadSelect<T>(this IDbConnection dbConn, Expression<Func<T, bool>> predicate, IEnumerable<string> include = null)
274274
{
275275
return dbConn.Exec(dbCmd => dbCmd.LoadSelect(predicate, include));
276276
}
@@ -288,7 +288,7 @@ public static List<T> LoadSelect<T>(this IDbConnection dbConn, Expression<Func<T
288288
/// Returns results with references from using an SqlExpression lambda. E.g:
289289
/// <para>db.LoadSelect&lt;Person&gt;(q =&gt; q.Where(x =&gt; x.Age &gt; 40))</para>
290290
/// </summary>
291-
public static List<T> LoadSelect<T>(this IDbConnection dbConn, Func<SqlExpression<T>, SqlExpression<T>> expression, string[] include = null)
291+
public static List<T> LoadSelect<T>(this IDbConnection dbConn, Func<SqlExpression<T>, SqlExpression<T>> expression, IEnumerable<string> include = null)
292292
{
293293
return dbConn.Exec(dbCmd => dbCmd.LoadSelect(expression, include));
294294
}
@@ -306,7 +306,7 @@ public static List<T> LoadSelect<T>(this IDbConnection dbConn, Func<SqlExpressio
306306
/// Returns results with references from using an SqlExpression lambda. E.g:
307307
/// <para>db.LoadSelect(db.From&lt;Person&gt;().Where(x =&gt; x.Age &gt; 40))</para>
308308
/// </summary>
309-
public static List<T> LoadSelect<T>(this IDbConnection dbConn, SqlExpression<T> expression = null, string[] include = null)
309+
public static List<T> LoadSelect<T>(this IDbConnection dbConn, SqlExpression<T> expression = null, IEnumerable<string> include = null)
310310
{
311311
return dbConn.Exec(dbCmd => dbCmd.LoadSelect(expression, include));
312312
}
@@ -323,7 +323,7 @@ public static List<T> LoadSelect<T>(this IDbConnection dbConn, SqlExpression<T>
323323
/// <summary>
324324
/// Project results with references from a number of joined tables into a different model
325325
/// </summary>
326-
public static List<Into> LoadSelect<Into, From>(this IDbConnection dbConn, SqlExpression<From> expression, string[] include = null)
326+
public static List<Into> LoadSelect<Into, From>(this IDbConnection dbConn, SqlExpression<From> expression, IEnumerable<string> include = null)
327327
{
328328
return dbConn.Exec(dbCmd => dbCmd.LoadSelect<Into, From>(expression, include));
329329
}

0 commit comments

Comments
 (0)