表达< func< tentity,int,bool>设置int值
我
public Expression<Func<TEntity, int, bool>> FilterExpr
表达
有
int i = 12;
//Pseudo Code which sets the value of the second Parameter
FilterExpr.Arg2 = i;
这个
Expression<Func<TEntity, bool>>
I have this Expression
public Expression<Func<TEntity, int, bool>> FilterExpr
And Now I want to eliminate/insert the value for the int value
like
int i = 12;
//Pseudo Code which sets the value of the second Parameter
FilterExpr.Arg2 = i;
the result should be a
Expression<Func<TEntity, bool>>
without the int parameter
thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过更换人体中的参数并使用一个参数创建新的lambda表达式来创建新的表达式。例如,使用此替换器(或
替换expressionVisitor
如果您使用的是EF Core 3.0+):并修改表达式:
You can create a new expression by replacing parameter in the body and creating new lambda expression with one parameter. For example using this replacer (or take
ReplacingExpressionVisitor
if you are using EF Core 3.0+):And modify expression: