cancel
Showing results for 
Search instead for 
Did you mean: 

Entity Framework : Filter child entities

Former Member
0 Kudos
3,818

Hello !

I'm using VB.net and entity Framework. I have situation where depending on several conditions I construct a query step by step .

This is the code :(Article has 2 relationship with F1 and F2)

Dim list1 As IEnumerable(Of Article)
     list1 = From t In context.Articles.Include("F1").Include("F2") Order By t.name Ascending
                 Select t
     If condition1 then
         list1 = list1.Where(Function(t2) t2.tp = 1)
     End If
     If condition2 then
         list1 = list1.Where(Function(t2) t2.id = 7)
     End If
     Myreport.datasource=list1.ToList()


This code is working , but now I want to add a new condition , and if this is true the child "F1" should be filtered.

How can I filter the Child "F1"

Thank you !

Accepted Solutions (0)

Answers (0)