开发者

How to select a table from highest table use LinQ query

I have a sequence relationship:

A has many Bs. B has many Cs. C has many Ds.

They al开发者_StackOverflow中文版so make me so confused if there are more than 3 or 4,..tables.

So, how can i select all Cs that satify A.Id="1". (something likes finding all grandsons of a grandfather)

Thanks in advance.


var x = from a in aArray
        from b in a.bArray
        from c in b.cArray
        where a.id == "1"
        select c;


I assume that you are using Linq-to-sql since you mention "table" in the topic.

var query = from c in context.C
            where c.b.a.id == "1"
            select c;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜