记录C#表达树调用
我希望使用从此处给出的示例开始使用表达式树创建一个简单的规则引擎: https://mobiusstraits.com/2015/08/12/expression-trees/
我想知道我如何记录每个规则的评估规则引擎。
理想情况下,我想拥有一个字符串列表,其中包含在给定模型上评估的每个规则的评估结果列表,例如。
“ field1传递值x匹配规则x” “ field2失败值x不匹配规则值y”
沿这些行。这将使StringList返回到调用规则引擎的任何功能。
我在这里遇到了这个答案: https://stackoverflow.com/a/34042462/1270329在表达类中没有解释()方法,所以很明显我错过了有关该解决方案的一些东西。
有人可以把我朝正确的方向设置吗?我应该提到我刚刚了解了这些表达树。
tia
I am looking to create a simple rules engine using expression trees starting from the example given here: https://mobiusstraits.com/2015/08/12/expression-trees/
I'm wondering how I might log the evaluation of each of the rules to that I can create a log of why the model failed the rules engine.
Ideally, I would like to have a stringlist containing a list of evaluation results for each of the rules evaluated on a given model, eg.
"Field1 passed value X matched rule X"
"Field2 failed value X did not match rule value Y"
something along those lines. This would enable to return the stringlist back to whatever function invoked the rules engine.
I came across this answer here: https://stackoverflow.com/a/34042462/1270329, which looked promising but there is no Interpret() method on an Expression class so clearly I've missed something about that solution.
Can someone set me in the right direction. I should mention I just learned of these expression trees.
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论