You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DynamicFilterInfodyfilter=JsonConvert.DeserializeObject<DynamicFilterInfo>(json);fsql.Select<Topic>().WhereDynamicFilter(dyfilter).ToList();// WHERE id = 1 AND (id = 2 OR title like 'new topic 1%')
nuget 安装 System.Linq.Dynamic.Core
//自定义代码publicclassDynamicFilterCustomImpl{//JSON Field 对应这个值publicstaticstringCustomLinq=$"{nameof(DynamicFilterCustomImpl.DynamicLinq)}{typeof(DynamicFilterCustomImpl).FullName},{typeof(DynamicFilterCustomImpl).Assembly.FullName}";[DynamicFilterCustom]publicstaticLambdaExpressionDynamicLinq(objectsender,stringvalue){if(string.IsNullOrWhiteSpace(value))value="1==2";ParameterExpressiont=Expression.Parameter(sender.GetType().GetGenericArguments()[0],"t");varexp=DynamicExpressionParser.ParseLambda(newParameterExpression[]{t},typeof(bool),value);returnexp;}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
先了解 WhereDynamicFilter
ISelect.WhereDynamicFilter 方法实现动态过滤条件(与前端交互),支持的操作符:
实现 DynamicFilterCustom
输入参数为 JSON,{{ DynamicFilterCustomImpl.CustomLinq }} 是一个固定的值,请往后面看 c# 代码
nuget 安装 System.Linq.Dynamic.Core
All reactions