LINQ with multiples ON in OR condition?

0

I'm encountering a problem using LINQ , I'm not very aware of how it does. I have the following code:

(from BEN in repositorioBEN.RetornaTodos()
    join CON in repositorioCON.RetornaTodos() on BEN.Handle equals CON.Handle
    join APO in repositorioAPO.RetornaTodos() on CON.Apolice.Handle equals APO.Handle
    join PGD in repositorioPGD.RetornaTodos() on new
    {
        ben = BEN.Handle,
        con = CON.Handle,
        fam = BEN.Familia,
        est = APO.NroDoEstipulante,
        cor = APO.Corretor
    }
    equals new
    {
        ben = PGD.Beneficiario.Handle,
        con = PGD.Contrato.Handle,
        fam = PGD.Familia,
        est = PGD.HandleApolice,
        cor = PGD.Corretor
    }
    join TGE in repositorioTGE.RetornaTodos() on PGD.RegimeAtendimento.Handle.ToString() equals TGE.RegimeAtendimento
    where (PGD.DataFinal >= DateTime.Now && PGD.DataInicial <= DateTime.Now && BEN.Handle == idBeneficiario && TGE.Handle == idEvento)
    select new
    {
         QtdeDiasPagtoDiferenciado = PGD.QtdeDiasPagtoDiferenciado
    })
    .SingleOrDefault();

In the part below, I need this condition to be OR and not AND .

How do I do it?

join PGD in repositorioPGD.RetornaTodos() on new
    {
        ben = BEN.Handle,
        con = CON.Handle,
        fam = BEN.Familia,
        est = APO.NroDoEstipulante,
        cor = APO.Corretor
    }
    equals new
    {
        ben = PGD.Beneficiario.Handle,
        con = PGD.Contrato.Handle,
        fam = PGD.Familia,
        est = PGD.HandleApolice,
        cor = PGD.Corretor
    }
    
asked by anonymous 04.10.2016 / 16:48

1 answer

0

There is no "OR" in the linq join, just the Equals, in which case you will have to subquery the filter to return the data you need.

    
11.01.2017 / 21:51