views:

45

answers:

1

I have 3 table a,b and c

a.Id,a.code /master
b.Id.b.code,b.aId,c.Id /detail
c.Id,c.code / detail of detail

i will join this three table with linq and show it in grid. How can i do this?

+1  A: 
var query = from recordA in context.TableA
            join recordB in context.TableB
            on recordA.Id equals recordB.aId
            join recordC in context.TableC
            on recordB.cId equals recordC.Id
            select new 
            {
               // whatever columns are appropriate
            };
Anthony Pegram
how can i write this query with lambda expression ?
drorhan
@drorhan, `.Join` is kind of ugly when represented in lambda syntax. If I have a moment, I'll come back and add in an example. But for now, I encourage you to download Linqpad. You can type query expressions and see the results in Lambda syntax, as well as SQL (if applicable) and IL.
Anthony Pegram
Thank you for answer and Linqpad. It is very usefull :)
drorhan