I am trying to get the following to work:
var rule = Rule.Create("Description", "Contains", "Do");
var expression = MRE.ToExpression<T>(rule);
var retVal = records.AsQueryable()
.Where(expression)
.ToList();
where records is a collection of T having a property named Description.
When I run the above code MRE.ToExpression<T>(rule) throws an InvalidOperationException with the message: No method 'Contains' on type 'System.String' is compatible with the supplied arguments.' exception.
Also found out that the following will throw the same exception when trying to compile the rule:
var rule = Rule.Create("Description", "Contains", "Do");
var compiledRule = new MRE().CompileRule<T>(rule);
var retVal = records.AsQueryable()
.Where(r => compiledRule(r))
.ToList();
I am trying to get the following to work:
where
recordsis a collection ofThaving a property namedDescription.When I run the above code
MRE.ToExpression<T>(rule)throws anInvalidOperationExceptionwith the message:No method 'Contains' on type 'System.String' is compatible with the supplied arguments.'exception.Also found out that the following will throw the same exception when trying to compile the rule: