DynamicFilterCustom 增加支持 Expression 返回值

This commit is contained in:
hd2y
2022-05-30 00:39:23 +08:00
parent 184d11d692
commit 4fe40d0be0
5 changed files with 410 additions and 21 deletions

View File

@@ -811,8 +811,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: