如何让 LinqPad 执行下面所示的左连接?
在 Management Studio 中,Linq Pad 创建的 SQL 运行得非常完美,但 Linq Pad 却没有显示任何行,并出现以下错误:
“InvalidOperationException: The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type.”
我该如何让 Linq Pad 正常工作以便我可以使用它?
var query =
from s in db.CDBLogsHeaders
.OrderByDescending(g => g.LogDateTime)
from sc in db.StyleColors
.Where(stylecolor => stylecolor.id == (int?)s.StyleColorID)
.DefaultIfEmpty()
from c in db.StyleHeaders
.Where(styleHeader => styleHeader.id == (int?)s.StyleHeaderID)
.DefaultIfEmpty()
select new
{
CDBLogsHeaderId = s.Id,
Merchandiser = c.Merchandiser,
Material = s.Material,
Season = s.Season,
LogsHeaderLogType = s.LogType,
PushFromTo = s.PushFromTo,
LinePlan = s.LinePlan,
QuikRefNumber = s.QuikRefNumber,
PLMOrigin = s.PLM_Origin,
SeasonOriginal = c.SeasonOriginal,
SeasonCurrent = c.SeasonCurrent,
StyleHeaderId = c.Id,
StyleCode = c.StyleCode,
StyleColorsColorCode = sc.ColorCode
};
query.Dump();
在 Management Studio 中,Linq Pad 创建的 SQL 运行得非常完美,但 Linq Pad 却没有显示任何行,并出现以下错误:
“InvalidOperationException: The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type.”
我该如何让 Linq Pad 正常工作以便我可以使用它?