Skip to content

A question about mapping expressions #33

@dahari87

Description

@dahari87

Hi,
i have the following method:
public string GetQuery(params Expression<Func<MyClass, object>>[] properties){}
so i able to use it this way:
GetQuery(x => x.FirstName, x => x.NestedProp.NestedValue);

how can i map the properties array to a valid IQuery?
tried the following:

foreach (var property in properties)
    {
        if (property.Body is MemberExpression)
        {
           // this works for MemberExpressions only
            query.AddField(property);
        }
        else
        {
          // here i have to handle nested expressions "x.NestedProp.NestedValue"
          // i'm not sure how to map the UnaryExpression to the query
        }
    }

can someone please give me a hint?
thanks in advanced

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