You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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
The text was updated successfully, but these errors were encountered: