@@ -256,9 +256,9 @@ public static List<T> LoadSelect<T>(this IDbConnection dbConn, Expression<Func<T
256
256
/// Returns results with references from using a LINQ Expression. E.g:
257
257
/// <para>db.LoadSelect<Person>(x => x.Age > 40, include: x => new { x.PrimaryAddress })</para>
258
258
/// </summary>
259
- public static List < T > LoadSelect < T > ( this IDbConnection dbConn , Expression < Func < T , bool > > predicate , Func < T , object > include )
259
+ public static List < T > LoadSelect < T > ( this IDbConnection dbConn , Expression < Func < T , bool > > predicate , Expression < Func < T , object > > include )
260
260
{
261
- return dbConn . Exec ( dbCmd => dbCmd . LoadSelect ( predicate , include ( typeof ( T ) . CreateInstance < T > ( ) ) . GetType ( ) . AllAnonFields ( ) ) ) ;
261
+ return dbConn . Exec ( dbCmd => dbCmd . LoadSelect ( predicate , include . GetFieldNames ( ) ) ) ;
262
262
}
263
263
264
264
/// <summary>
@@ -274,9 +274,9 @@ public static List<T> LoadSelect<T>(this IDbConnection dbConn, SqlExpression<T>
274
274
/// Returns results with references from using an SqlExpression lambda. E.g:
275
275
/// <para>db.LoadSelect(db.From<Person>().Where(x => x.Age > 40), include: x => new { x.PrimaryAddress })</para>
276
276
/// </summary>
277
- public static List < T > LoadSelect < T > ( this IDbConnection dbConn , SqlExpression < T > expression , Func < T , object > include )
277
+ public static List < T > LoadSelect < T > ( this IDbConnection dbConn , SqlExpression < T > expression , Expression < Func < T , object > > include )
278
278
{
279
- return dbConn . Exec ( dbCmd => dbCmd . LoadSelect ( expression , include ( typeof ( T ) . CreateInstance < T > ( ) ) . GetType ( ) . AllAnonFields ( ) ) ) ;
279
+ return dbConn . Exec ( dbCmd => dbCmd . LoadSelect ( expression , include . GetFieldNames ( ) ) ) ;
280
280
}
281
281
282
282
/// <summary>
@@ -290,9 +290,9 @@ public static List<Into> LoadSelect<Into, From>(this IDbConnection dbConn, SqlEx
290
290
/// <summary>
291
291
/// Project results with references from a number of joined tables into a different model
292
292
/// </summary>
293
- public static List < Into > LoadSelect < Into , From > ( this IDbConnection dbConn , SqlExpression < From > expression , Func < Into , object > include )
293
+ public static List < Into > LoadSelect < Into , From > ( this IDbConnection dbConn , SqlExpression < From > expression , Expression < Func < Into , object > > include )
294
294
{
295
- return dbConn . Exec ( dbCmd => dbCmd . LoadSelect < Into , From > ( expression , include ( typeof ( Into ) . CreateInstance < Into > ( ) ) . GetType ( ) . AllAnonFields ( ) ) ) ;
295
+ return dbConn . Exec ( dbCmd => dbCmd . LoadSelect < Into , From > ( expression , include . GetFieldNames ( ) ) ) ;
296
296
}
297
297
}
298
298
}
0 commit comments