Filter in child list LINQ Entity Framework

c# entity-framework-core

Question

I have list function contain list language in side

I want to filter that list Language with condition CulNo = "en".

Here is my code:

var functionLang = 
    functionVm.Where(x => x.Language.Any(y => y.LanguageCountry.CulNo == cul));

But it still returns all languages. How can I filter with list function have list language with my condition?

1
0
7/20/2018 4:43:08 AM

Popular Answer

You could try anonymous projection to filter

var langs = language
           .Select(g=> new 
           {
             g =  g.Language.where(y => y.LanguageCountry.CulNo == cul)
           }).ToList();

Filter child entities reference

0
7/30/2018 6:22:52 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