在实体对象中访问导航属性里的属性值出现异常“There is already an open DataReader associated with this Command which must be closed first”. public class User { public long UserId { get; set; } public string UserName { get; set; } public string UserPwd { get; set; } public D…
执行SqlDataReader.Read之后,如果还想用另一个SqlCommand执行Insert或者Update操作的话,会得到一个错误提示:There is already an open DataReader associated with this Command which must be closed first.,然后一般就会产生数据保存失败的异常. 解决方法是在ConnectionString中加上一个参数“MultipleActiveResultSets”, 将其值设置为tru…
规则引擎集合相关处理 在实际生产过程中,有很多关于集合的处理场景,比如一个Fact对象中包含有一个集合,而需要判断该集合是否包含某个值.而Drools规则引擎也提供了多种处理方式,比如通过from.contains.exists等进行操作,比较. 当然也可以通过function函数来做相应的比较,在个在其他章节讲到过,就不在此赘述.下面重点以几个实例才进行讲解,在具体实践中根据具体情况来进行运用. 实例 省略掉基本的配置,直接看调用代码和规则代码. 测试调用代码: public class Co…
为此对象添加KnownType属性(Attribute).类型为用接口声明的属性(Property)的所有可能类型. 示例如下: public interface IKey { [DataMember] int Id { get; set; } [DataMember] string Name { get; set; } } [DataContract] public abstract class KeyBase : IKey { [DataMember] public int Id { ge…