我有这个LINQ查询:
var gbaJoinTasksAndBatches = from gbajoin in _db.GBatchAudit
join task1 in _db.TTask on gbajoin.TaskId equals task1.TaskId
join batch1 in _db.TBatch on gbajoin.BatchId equals batch1.BatchId
where gbajoin.EntryTime >= ReporterArgs.FromDate &&
gbajoin.EntryTime <= ReporterArgs.ToDate &&
gbajoin.EntryType == 1
orderby gbajoin.EntryTime
select new
{
gbajoin.EntryTime,
gbajoin.BatchRunNum,
task1.TaskId,
task1.TaskName,
batch1.BatchId,
batch1.BatchName
};
var gbaGroupedByErrorMessage = from gbaJoin in gbaJoinTasksAndBatches
group gbaJoin by new
{
gbaJoin.BatchRunNum,
Task = gbaJoin.TaskName,
TaskId = gbaJoin.TaskId,
Batch = gbaJoin.BatchName,
BatchId = gbaJoin.BatchId,
} into taskBatchGroup
select new TaskListDto
{
BatchName = taskBatchGroup.Key.Batch,
BatchId = taskBatchGroup.Key.BatchId,
TaskName = taskBatchGroup.Key.Task,
TaskId = taskBatchGroup.Key.TaskId,
BatchRunNumber = taskBatchGroup.Key.BatchRunNum,
StartTime = taskBatchGroup.Min(grp => grp.EntryTime)
};
return await gbaGroupedByErrorMessage.OrderBy(t => t.StartTime).ToListAsync();
我一直收到错误&#34;&#39; MIN&#39;不是公认的内置函数名称。&#34; 但我真的不明白为什么。 我认为它在那一行的某个地方:
StartTime = taskBatchGroup.Min(grp => grp.EntryTime)
但我做想要获得该查询的最小日期时间的分组。 奇怪的是,在我将.net软件包更新到2.1.0-preview2-final之前,它实际上一直工作到昨天为止
提前致谢