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

Select on ForeignKey properties: main level name missing #715

Closed
Hurricane31337 opened this issue Jun 12, 2023 · 1 comment
Closed

Select on ForeignKey properties: main level name missing #715

Hurricane31337 opened this issue Jun 12, 2023 · 1 comment
Assignees
Labels

Comments

@Hurricane31337
Copy link

Using the dbContext.TableName.Select("Property1, Property2.Property5") syntax, how can I achieve that the property names in the output are kept exactly as put in? Currently, the result would contain Property1 and Property5 (instead of Property2.Property5).
Using the "AS" operator also doesn't help, because firstly I can't use dots in the renamed property name (as required) and secondly, it would be cumbersome to specify it for each selector over and over again.

I would very much welcome an optional parameter for the Select function to be able to keep the main level names.

@StefH StefH self-assigned this Aug 6, 2023
@StefH StefH added the question label Aug 6, 2023
@StefH
Copy link
Collaborator

StefH commented Aug 6, 2023

This should be made possible in PR #719

SupportDotInPropertyNames

Support a . in a property-name. Default value is false.

var config = new ParsingConfig
{
    SupportDotInPropertyNames = true
};

var result = persons.Select(config, "new (Profile.FirstName as Prof.Name)").ToDynamicArray();

@StefH StefH closed this as completed Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants