Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MRE.ToExpression throws exception #23

Copy link
Copy link
@Vrungar

Description

@Vrungar
Issue body actions

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.