Join with lambda expression only

1

With LINQ without problems. Now, how do I join with two or more tables? Below the join attempt I could not go through to the end. Two tables ( T_Acao and T_ProximaAcao ). Field in join is IDAcao

var resultadoAcao = (db.T_Acao
                                    .Where(a => a.IDAcao == 7)
                                    .Join(db.T_ProximaAcao, p => p.IDAcao )
                                );

How do I end this join?

    
asked by anonymous 27.05.2014 / 16:34

1 answer

2

Solved. A colleague passed me:

var resultadoAcao = (db.T_Acao.Join(
                                    db.T_ProximaAcao,
                                    t1 => t1.IDAcao,
                                    t2 => t2.IDAcao,
                                    (t1, t2) => new { t1, t2})
                                    .Where( a => a.t1.IDAcao == 7)
                                     .Select(i => new {acao = i.t1.Acao, proximaacao = i.t2.ProximaAcao})
                                ).ToList();
    
27.05.2014 / 16:56