Skip to content

Transition Dynamic LINQ writer/visitor output to actual code #82

@zspitz

Description

@zspitz

Currently, the Dynamic LINQ writer/visitor outputs a simple string. This means:

  • it cannot be copied/pasted directly without potential modification: specifically, string literal and char literal escaping
  • we can't display Dynamic LINQ method calls, even though all they do is transform the expression tree

For example:

// using System.Dynamic.Linq.Core;

public c;lass Person {
    public string LastName {get;set;}
}

var expr = Enumerable.Empty<Person>().AsQueryable().Where("LastName = \"A\"").Expression;
Console.WriteLine(expr.ToString("Dynamic LINQ"));

prints an error, because the call to .Where is not valid within a selector, and thus not renderable.

Ideally, we'd like to see this:

#EnumerablePerson.AsQueryable().Where("LastName = \"A\"")

which shows the Dynamic LINQ method calls, and can be copied/pasted much more easily.

This would require knowledge of the language (C# / VB) for rendering string literals.

Related: #78,

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