您好,我正在尝试在查询中减去两个 DateTime,并将差异与 timeInterval 进行比较,但我得到了例外:
<Message>An error has occurred.</Message>
<ExceptionMessage>System.TimeSpan Subtract(System.DateTime)</ExceptionMessage>
<ExceptionType>System.NotSupportedException</ExceptionType>
C#代码:
producerRelations = producerRelationRepository.Query().Fetch(c => c.Order).
Where(c => c.Order.CreatedBy == login).
Where(c=>currentDate.Subtract(c.RouteUnit.DtStart.Value).TotalMinutes<timeInterval);
如何在代码中减去日期?