小编Kis*_*ore的帖子

在 NRULES 中实现前向链接的最佳方式

我想根据前一个规则的结果运行一个规则。如何使用前向链接实现此功能?我不想为每个规则创建不同的类对象来实现前向链接。

在此示例中,仅为这一规则创建了一个 InstantDiscount 对象以实现前向链接。

public class PreferredCustomerDiscountRule : Rule
{
    public override void Define()
    {
        Customer customer = null;
        IEnumerable<Order> orders = null;
        Double total = Double.NaN;

        When()
            .Match<Customer>(() => customer, c => c.IsPreferred)
            .Query(() => orders, x => x
                .Match<Order>(
                    o => o.Customer == customer,
                    o => o.IsOpen)
                .Collect())
            .Let(() => total, () => orders.Sum(x => x.Amount))
            .Having(() => total > 1000);

        Then()
            .Yield(_ => new InstantDiscount(customer, total * 0.05));
    }
}

public class PrintInstantDiscountRule : Rule
{
    public …
Run Code Online (Sandbox Code Playgroud)

nrules

1
推荐指数
1
解决办法
1786
查看次数

PowerShell 以管理员身份运行

当我以管理员身份运行批处理脚本时,我遇到了以下问题。当我正常运行相同的脚本时,没有问题。

请分享一些关于这个问题的想法。

错误快照

powershell admin

-1
推荐指数
1
解决办法
409
查看次数

标签 统计

admin ×1

nrules ×1

powershell ×1