0
I tried to do a left Join on LINQ as follows:
(from opr in db.Operacao
join vol in db.Volume on new { VOL_CODBAR = opr.OPR_CODBAR } equals new { VOL_CODBAR = vol.VOL_CODBAR } into vol_join
from vol in vol_join.DefaultIfEmpty()
select new {
opr.OPR_IDX,
opr.OPR_CODEMP,
opr.OPR_CODFIL,
opr.OPR_NUMVEI,
opr.OPR_TIPOPR,
vol.VOL_TITLE
})
But at runtime, the exception is generated:
LINQ to Entities does not recognize the 'System.Collections.Generic.Ienumerable' method
1[ImprotecSistemas.PackLocator.PackServer.DataAccess.vwObtemFuncionario] DefaultIfEmpty[Operacao](System.Collections.Generic.IEnumerable
1[Improtecsistemas.PackLocator.Packserver.DataAccess.Operation])', which cannot be converted into a storage expression.
Below is what I want in SQL:
Select *
From operacao opr
left join volumes vol on vol.VOL_CODBAR = OPR.OPR_CODBAR
I am using Entity Framework 3.5 C#
Have you tried so, with the equals without alias? Instead of
new { VOL_CODBAR = opr.OPR_CODBAR } equals new { VOL_CODBAR = vol.VOL_CODBAR }
onlyopr.OPR_CODBAR equals vol.VOL_CODBAR
?– iuristona
Yes. I have tried this way, and several others, but always error in function
DefaultIfEmpty()
. To make a palliative, I created a subselect, because at the moment I just need a column from the second table. But, this is not the correct.– Diego Moreno
researched and found that in fact
DefaultIfEmpty()
is not supported onEntity Framework 3.5
.– iuristona
Is there any alternative for him?
– Diego Moreno