If I have a method that returns List of Dogs, then Dapperconverts the predicate Whereto SQLWhere? or does he first get all the dogs and then filter the list?
List of Dogs
Dapper
Where
SQL
public IList<Dog> GetDogsBy(Func<Dog, bool> predicate) { return db.Query<Dog>("SELECT * FROM Dog",null).Where(predicate).ToList(); }
It depends on the resolution of the overload when enabled Where.
If the result of the call Queryis List<Dog>, and you have a directive using System.Linq;, and the argument is a delegate, then it Wherewill be resolved to the LINQ-to-objects version Where. Thus, the selection request will be executed on the server, and then Wherewill be executed on the client.
Query
List<Dog>
using System.Linq;
Query IQueryable<Dog>, Expression, Where, . , Where , , .
IQueryable<Dog>
Expression
SQL trnalsation, , . , , IL , .NET API, .
Func<...> Expression<Func<...>>, , , , , , , .
Func<...>
Expression<Func<...>>
public IList<Dog> GetDogsBy(Expression<Func<Dog, bool>> predicate)
, Dapper.