Created
June 23, 2017 22:02
-
-
Save matt-hensley/9a3df25430c789702dd37d87c5d11fb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading.Tasks; | |
//using Dapper.FastCrud; | |
//using Dapper.FastCrud.Configuration; | |
using Dapper.FastCrud.Configuration.StatementOptions; | |
//using Dapper.FastCrud.Configuration.StatementOptions.Builders; | |
//using Dapper.FastCrud.Mappings; | |
namespace DapperSample { | |
public static class SqlExtensions { | |
public static TStatementOptionsBuilder Where<TEntity, TStatementOptionsBuilder, TValue>(this IConditionalSqlStatementOptionsOptionsSetter<TEntity, TStatementOptionsBuilder> sql, | |
Expression<Func<TEntity, TValue>> expression, | |
string op, | |
TValue value) { | |
var name = StaticReflection.GetMemberName(expression); | |
return SqlExtensions.Where(sql, name, op, value); | |
} | |
public static TStatementOptionsBuilder Where<TEntity, TStatementOptionsBuilder, TValue>(this IConditionalSqlStatementOptionsOptionsSetter<TEntity, TStatementOptionsBuilder> sql, | |
string name, | |
string op, | |
TValue value) { | |
return sql.Where($"{name:C}{op}{value}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment