adamfoneil / Dapper.CX

A Crud library based on Dapper
MIT License
8 stars 1 forks source link

GetWhere method that builds WHERE clause from lambda #31

Closed adamfoneil closed 3 years ago

adamfoneil commented 3 years ago

Should work much like the Update* methods that do the same.

adamfoneil commented 3 years ago

Turns out this is a little different from what Update* does. See WhereClauseExpression. I think the Update* methods could be reworked to leverage this syntax. Currently, the issue with lambda updates is you have to set your properties separately before your actual Update call. It would be neat if the syntax was more compact, like this:

await cn.UpdateAsync(model, 
    x => x.FirstName = "Django",
    x => x.LastName = "Whatever");
adamfoneil commented 3 years ago

See test for usage example: GetEmployeeWhereLambda