Я использую фреймворк 3.5.У меня есть один синтаксис группы Linq, как показано ниже:
var TmpClause = (from c in MES_WO_Tracking
join s in WorkOrders
on c.WoNo equals s.OrderNum
where s.Plant == "XX" && c.Shift != null
group new {
c.QtyComplete,
c.QtyScrap
}
by new
{
MRP = s.MRP_CTLR,
SeqNo = c.SeqNo,
TriggerSAP = c.TriggerSAP,
Shift = c.Shift
} into n
select new BkdKPIOutput
{
MRP = n.Key.MRP,
SeqNo = n.Key.SeqNo + n.Key.TriggerSAP,
Shift = n.Key.Shift,
OutputQty = n.Sum(c => c.QtyComplete.Value),
InputQty = n.Sum(c => c.QtyScrap.Value) + n.Sum(c => c.QtyComplete.Value)
});
Это всегда дает мне ошибку «Тайм-аут оценки функции».Но странно то, что я проверяю родной sql, он тратит всего 1 сек.
SELECT [t2].[MRP_CTLR] AS [MRP] ,
[t2].[SeqNo] + [t2].[TriggerSAP] AS [SeqNo] ,
[t2].[Shift] ,
[t2].[value] AS [OutputQty] ,
[t2].[value2] + [t2].[value3] AS [InputQty] FROM ( SELECT SUM([t0].[QtyComplete]) AS [value] ,
SUM([t0].[QtyScrap]) AS [value2] ,
SUM([t0].[QtyComplete]) AS [value3] ,
[t1].[MRP_CTLR] ,
[t0].[SeqNo] ,
[t0].[TriggerSAP] ,
[t0].[Shift]
FROM [MES_WO_Tracking] AS [t0]
INNER JOIN [WorkOrder] AS [t1] ON [t0].[WoNo] = [t1].[OrderNum]
WHERE ( [t1].[Plant] = 'XX' )
AND ( [t0].[Shift] IS NOT NULL )
GROUP BY [t1].[MRP_CTLR] ,
[t0].[SeqNo] ,
[t0].[TriggerSAP] ,
[t0].[Shift]
) AS [t2]
Кто-нибудь знает это?Очень признателен за вашу помощь.