Merge pull request #1130 from hd2y/issues@1113

DynamicFilterCustom 增加支持 Expression 返回值
This commit is contained in:
2881099
2022-07-17 13:02:39 +08:00
committed by GitHub
4 changed files with 412 additions and 12 deletions

View File

@ -832,8 +832,8 @@ namespace FreeSql.Internal.CommonProvider
var fiValue0MethodReturn = fiValue0Method?.Invoke(null, fiValue0Method.GetParameters()
.Select(a => a.ParameterType == typeof(object) ? (object)this :
(a.ParameterType == typeof(string) ? (object)(fi.Value?.ToString()) : (object)null))
.ToArray())?.ToString();
exp = Expression.Call(typeof(SqlExt).GetMethod("InternalRawSql", BindingFlags.NonPublic | BindingFlags.Static), Expression.Constant(fiValue0MethodReturn, typeof(string)));
.ToArray());
exp = fiValue0MethodReturn is Expression expression ? expression : Expression.Call(typeof(SqlExt).GetMethod("InternalRawSql", BindingFlags.NonPublic | BindingFlags.Static), Expression.Constant(fiValue0MethodReturn?.ToString(), typeof(string)));
break;
case DynamicFilterOperator.Contains: