Get list from list of elements link and collections
-
Hi, I have 3 tables in the back end - I am trying to load them using include statement of Entity Framework TableA is parent of TableB which is parent of TableC (from a in TableA select a).Include("TableB").Include("TableB.TableC") Now I want to get List using a Linq, how can I do it? I am trying in the below way - its giving me compile error - any help please? Thanks in advance.
List cs = (from a in tablea.TableBs select a.TableCs.ToList());
Any help in achieving this, that how can I get the List of TableCs in one list using linq queries
-
Hi, I have 3 tables in the back end - I am trying to load them using include statement of Entity Framework TableA is parent of TableB which is parent of TableC (from a in TableA select a).Include("TableB").Include("TableB.TableC") Now I want to get List using a Linq, how can I do it? I am trying in the below way - its giving me compile error - any help please? Thanks in advance.
List cs = (from a in tablea.TableBs select a.TableCs.ToList());
Any help in achieving this, that how can I get the List of TableCs in one list using linq queries
If you want a list of
TableC
s, then start with theTableC
s. Use the navigation properties to include the parent and grandparent entities if required.List<TableC> cs = tablea.TablesCs.Include(c => c.TableB.TableA).ToList();
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
If you want a list of
TableC
s, then start with theTableC
s. Use the navigation properties to include the parent and grandparent entities if required.List<TableC> cs = tablea.TablesCs.Include(c => c.TableB.TableA).ToList();
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Yes I did that - thank you for your suggestion :)