Entity Framework : Create a query step by step and at the end get data from database

tiku

New member
Joined
Feb 4, 2015
Messages
1
Programming Experience
Beginner
Hello !
I want to know how is possible to create a such scenario in Entity Framework : ( I have described the conditions with words , to better understand what I want )
ParentObject - has 2 child entities Child1 and Child2.
----------------------------------------------------------

Dim MyList as IQueryable ( of ParentObject)
Mylist=Context.Set(Of ParentObject)
If condition1 then ...."From Mylist Select the ParentObjects with ".vl1=1 ..." End if

If Condition2 then ..."From Mylist select the ParentObjects with ".id>=5 ..." End if

If Condition3 then ....For all the ParentObjects in MyList , Include the items on Child1 that have ".quantity>3".... End if

If condition4 then ....For all the ParentObjects in MyList , from the items on Child1 ( of course form all or from those that have been included in condition3 if it was true ) include only those that have ".value5=0.... end if

If condition5 then ....For all the ParentObjects in MyList , Include the items from Child2 that have .type=3....." End if

MyList.Tolist()
------------------------------------------------
The true problem is on Condition 3 , 4 and 5.
What can I do ?
Thank you !
 
Back
Top