0

我有 In Rule 方法,它应该接受一组简单类型,例如字符串类型数组或整数数组(int16)。

我尝试创建以下方法

/* Method with string array*/
[Method(DisplayName = "[M1]")]
    public int Method1([Parameter(ValueInputType.All)] 
                        string[] valStrings )
    {
        return valStrings.Length; // any calculation goes here
    }
}

/* Method with PARAMS string array*/
[Method(DisplayName = "[M2]")]
    public int Method2([Parameter(ValueInputType.All)] 
                       params string[] valStrings )
    {
        return valStrings.Length; // any calculation goes here
    }
}

/* Method with INT ARRAY referencing on external data source*/
[Method(DisplayName = "[M2]")]
    public int Method2([Parameter(ValueInputType.All,
                        DataSourceName="myDataList" )] 
                       params int[] valInt )
    {
        return valInt; // any calculation goes here
    }
}

似乎 codeeffect 库4.3.2.6不支持将用户输入的参数传递给 In-Rule 方法,并且仅使用简单的参数类型(例如Int而不是int[] )限制 In-Rule 方法。似乎我无法将 DataSource 与 In Rule 方法连接以将多个项目从数据源传递到 in-rule 方法中。只有 USER 应输入简单类型或选择多个数据源项的主要思想?我不能限制用户从返回集合的源对象传递源对象字段。

有什么建议或解决方法吗?

4

1 回答 1

0

CodeEffects 支持将 IEnumerable 类型的字段作为参数的规则内方法。规则内方法还可以返回 IEnumerable 集合,包括数组。但是,由于 .NET 反射的某些限制,它不能将数组作为参数。Code Effects 通常也不支持任何类型的数组的用户输入,因为这对于开发人员和最终用户来说将是一场 UI 噩梦。更多信息可在此处此处获得

您可以使用动态菜单数据源将数据库中的数据用作值或参数。详细信息可以在这里找到

于 2017-01-11T16:08:51.287 回答