Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate expression trees in compiled models (query filters, value converters) #29924

Closed
roji opened this issue Dec 23, 2022 · 4 comments
Closed
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Dec 23, 2022

The compiled model currently has the limitation that expression tree lambdas cannot be rendered (e.g. query filters). The ongoing work on precompiled queries includes a visitor that can generate a faithful C# code representation from a LINQ expression tree, so we could possibly use that to remove the restriction.

From a conversation with @ajcvickers

@roji
Copy link
Member Author

roji commented Dec 24, 2022

Note that this isn't necessarily about replacing the entire current code generation mechanism with a Roslyn-based one - we can use the LINQ->C# visitor only for lambda fragments and keep the rest as it is.

Replacing the entire mechanism might be worth considering:

  • Various formatting, whitespace and the rest is taken care of automatically, so the process would be considerably simplified
  • User formatting and settings (e.g. .editorconfig) are automatically taken into account
  • It would probably make supporting VB really easy, since Roslyn's SyntaxGenerator allows for generating documents in a language-agnostic way.
    • On the flip side, it would make it impossible to support F#, since it isn't supported by Roslyn.

@ajcvickers
Copy link
Member

Note from triage: Query filter case is most interesting here. Make sure that captured context access is preserved.

@roji
Copy link
Member Author

roji commented Dec 4, 2023

@AndriySvyryd we've already done work on this right? Is it useful to keep this, maybe possibly to add a task list for things not yet done?

@AndriySvyryd
Copy link
Member

I think #24897 captures what's left.

@AndriySvyryd AndriySvyryd added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Dec 6, 2023
@AndriySvyryd AndriySvyryd removed their assignment Dec 6, 2023
@AndriySvyryd AndriySvyryd modified the milestones: Backlog, 9.0.0 Dec 6, 2023
@ajcvickers ajcvickers modified the milestones: 9.0.0, 9.0.0-preview1 Jan 31, 2024
@roji roji modified the milestones: 9.0.0-preview1, 9.0.0 Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants