我不确定为什么会收到错误消息:“必须是可还原节点”
我尝试了此解决方案,但出现“必须是可还原节点”错误。我正在使用 EF Core 2.2 运行 Core 2
try
{
TimeSpan start = new TimeSpan(Convert.ToInt32(firm.OpeningHours.Split('-')[0].Split(':')[0]), Convert.ToInt32(firm.OpeningHours.Split('-')[0].Split(':')[1]), 0);
var totals = await _unitOfWork.Additions.GetAll().Where(x => x.FirmId == firm.FirmId && x.State == false && x.Closing >= opening && x.Closing <= closing)
.GroupBy(x =>
new {
Y = x.Closing.Value.Year,
M = x.Closing.Value.Month,
D = x.Closing.Value.TimeOfDay >= start ? x.Closing.Value.Day : x.Closing.Value.Day - 1
})
.Select(s => new
{
onKey = Convert.ToDateTime(new DateTime(s.Key.Y, s.Key.M, s.Key.D)).ToShortDateString(),
total = s.Sum(c => c.Price)
}).ToListAsync();
return new BaseResponse<object>(totals);
}
catch (Exception ex)
{
return new BaseResponse<object>(ex.Message);
}
我使用的数据库提供程序是 Pomelo.EntityFrameworkCore.MySql 版本 2.2.6