如何解决Microsoft Json 规则引擎自定义错误消息
我将以下库用于 json 基本规则引擎。 https://github.com/microsoft/RulesEngine
我想将属性值连接到错误消息中。我有一个集合列表,我想连接列表中满足表达式条件的项目。
{
"RuleName": "CheckforVTPumpSelectionErrors121-03","ErrorMessage": "WARNING: 121 - VT PUMP Manual Pick Required for {0} HP {1} pump!","Expression": "ProductFamily.PumpConfigurations.Any(r => r.PumpDescription == \"Water Feature\" || r.PumpDescription == \"Transfer\") && Flag1 == false"
}
我想用马力值替换 {0}。
我的 DTO:
public class ProductFamily
{
public int SCCR = 30;
public List<PumpConfiguration> PumpConfigurations { get; set; }
}
public class PumpConfiguration
{
public PumpConfiguration()
{
}
public string PumpDescription { get; internal set; }
public int HP { get; internal set; }
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。