I am trying to make a join between tables using linq where the key that joins them must be composed of two fields
var devengados = (from inten in ctx.INTENCIONES
join contr in ctx.CONTRATOS on inten.intencion_id equals contr.intencion_id
join intFin in ctx.INTENCIONES_FINANCIAMIENTO on new { inten.intencion_id, inten.orden } equals new { intFin.intencion_id, intFin.orden }
where contr.contrato_id == iContratoId
select new { inten, contr, intFin }).First();
With this structure I have an error in the join of intFin:
Error 31 The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.
Make sure the types and names of the properties you are comparing match. Try the following:
If you have different data types, try to do the necessary conversions, like the following:
Also make sure you're not comparing one property
nulleable
to another with isn't, if this is the case you can also do a conversion like the following: