mysql - Fetch all records with child tables which have many to many relationship using LINQ -


i have table columns id , name. table b child table 1 many relationship table a. have table c has 1 many relationship table b. want fetch records of table along related table b data , table c data.

what best approach doing in linq sql using entity framework. need write separate queries. or possible fetch in single query transaction.

i have tried including table b when select table a. select table c data, need loop through table b or possible direct linq query

if using entity framework can use .include() method

http://msdn.microsoft.com/en-us/library/bb738708.aspx

it's hard give example without knowing actual situation query might lok this:

var data = context.tablea.include("tableb"); 

and if wanted tablec then...

var data = context.tablea.include("tableb.tablec"); 

Comments