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

Include Function Backward Compatibility For Generic Repositories #5318

Closed
timbilt opened this issue May 10, 2016 · 1 comment
Closed

Include Function Backward Compatibility For Generic Repositories #5318

timbilt opened this issue May 10, 2016 · 1 comment

Comments

@timbilt
Copy link

timbilt commented May 10, 2016

Support of generic repositories is very important. A major problem with EF 7/Core is that the new syntax for the Include/ThenInclude functions provide more intuitive readability, but make it very difficult to write a generic repository to include navigation relationships. We were always able to pass a list of object-returning lamdas based on the queried entity type to select any relational table we want.

rep.GetAll<User>(u => u.Company.Country, u => u.Files.Select(f => f.FileDetail))

The above query which gets all users and "Include"s the users (Company, Country, Files, and FileDetail), now throws an error in EF 7/Core. This code should have been supported whilst adding the intuitive Include/ThenInclude. But to write a generic repository that supports the above code is very hard. And if it's restructured to support Include/ThenInclude the parameters will be some ugly object. Please allow us to continue using our existing generic repositories or provide a solution for generic repositories that allows including related tables via navigation properties.

Thanks so much

@rowanmiller
Copy link
Contributor

EF Team Triage: Our plan is to also have string based include, we just haven't implemented it yet. With the new C# nameof feature, this gives a decent way to handle these more dynamic scenarios. At this stage, we aren't really keen to enable a second pattern for lambda based includes.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants