0
I need to mount this query in Entity
select
ped.Id,
prot.Prot_numero as Protocolo,
ori.Descricao as Sistema,
cla.Id as Equipe,
cla.Descricao as Finalidade,
forn.Nome as Fornecedor
from Pedidos ped
join Protocolo prot on ped.ProtocoloId = prot.Id
join Origem ori on ori.Id = prot.OrigemId
join Classificacao cla on cla.Id = prot.ClassificacaoId
left join Contrato cont on ped.ContratoId = cont.Id
left join Fornecedor forn on cont.CodigoSAP = forn.CodigoSAP
where StatusPedidoId = 9
Only when I put the groupjoin it gives me error.
The type Arguments for method cannot be inferred from the Usage
Linq:
var infoPedidos = db.Pedidos.Where(p => p.StatusPedidoId == 9)
.Join(db.Protocolos, ped => ped.ProtocoloId, prot => prot.Id, (ped, prot) => new {
ped,
prot
})
.Join(db.Origens, prot => prot.prot.Id, ori => ori.Id, (prot, ori) => new {
prot,
ori
})
.Join(db.Classificacao, prot => prot.prot.prot.ClassificacaoId, cla => cla.Id, (prot, cla) => new {
prot,
cla
})
.GroupJoin(db.Contratos, cont => cont.prot.prot.ped.ContratoId, ped => ped.Id, (cont, ped) => new {
cont,
ped
})
.Select(x => new {
x.prot.prot.prot.prot.Id
});
How to do?
What mistake he gives you?
– Netinho Santos
Correlates the Elements of two sequences based on Equality of Keys and groups the Results. The default Equality Comparer is used to compare Keys.
– gabrielfalieri