我正在尝试使用 Flee 进行字符串文字检查,但我无法让它工作,当我指定字符串值时,我试图检查它是否尝试使用变量。这是ny代码:
var context = new ExpressionContext();
context.Variables.DefineVariable("User", typeof(User));
const string exp = @"(User.UserName = JWilly)";
var expression = context.CompileDynamic(exp);
var user = new User
{
Id = 1,
UserName = "JWilly",
Active = false,
};
context.Variables["User"] = user;
var result = expression.Evaluate();
相关分类