I have this query in SQL, and I want it to implement it in LINQ (Two tables, Caratulas, Interprete with many-to-many relation, Discos) SQL:
SELECT
Caratulas.Color, Caratulas.Forma, Caratulas.Tamano,Caratulas.Tipo
FROM
((Caratulas LEFT OUTER JOIN Discos ON Caratulas.Tipo = Discos.Tipo)
LEFT OUTER JOIN Interprete ON Discos.EtiquetaextSoporte = Interprete.EtiquetaextSoporte)
WHERE (Interprete.EtiquetaextSoporte = ?)
LINQ:
var FillCaratulasDesdeInterprete = caratulas.Rows.Cast<DataRow>()
.Join(Discos.Rows.Cast<DataRow>().Join(Interprete.Rows.Cast<DataRow>(),
rowSV => rowSV["EtiquetaextSoporte"],
rowS => rowS["EtiquetaextSoporte"],
rowSV => rowSV)
.Where(x => x["EtiquetaextSoporte"] == cadenaDesdeInterprete).DefaultIfEmpty(),
codV => codV["Tipo"],
codSV => codSV["Tipo"],
codV => codV)
.Where(z => z["Tipo"] == rowSV["Tipo"]).DefaultIfEmpty();
cadenaDesdeInterprete: param
but I have an error:
Error type arguments for method
'System.Linq.Enumerable.Join<TOuter,TInner,TKey,TResult>(System.Collections.Generic.IEnumerable<TOuter>, System.Collections.Generic.IEnumerable <TInner>, System.Func <Touter, TKey>, System.Func <TInner, TKey>, System.Func <Touter, TInner, TResult>) 'they can not be inferred from the use. Try specifying the type arguments explicitly.
I thought my errors are "rowSV => rowSV", and "codV => codV" Thanks for your help.