EF 6 filtering child collections

c# entity-framework-6

Question

I encountered the following problem while attempting to convert an old project from Linq2Sql to EF6.

This project is multilingual (each text has more than one translation), and the database structure is as follows:

Example of DB tables

How can I retrieve every instance of ExampleEntity1 with every LocalizedContent record filtered by the current language id?

Using the code below, I can load all ExampleEntity1 objects with all LocalizedContent records:dc.ExampleEntity1.Include(ee => ee.TextEntry.LocalizedContents);

In Linq2Sql I can filter LocalizedContent records usingloadOptions.AssociateWith however, I am unable to discover a fix for EF6.

I'm simply curious as to whether there is a solution for EF6 after seeing similar old inquiries that were posted about 2-3 years ago. The fact that I have dozens of entities in the project and don't want to construct custom objects for each select query makes it a crucial feature for me.

Also discovered was EntityFramework. Although the DynamicFilters nuget package can solve my problem, if at all possible, I would prefer to use "native" EF6 capability.

1
11
12/4/2015 1:11:00 AM

Popular Answer

ZZZ_tmp
3
12/4/2015 9:05:56 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow