我需要按查询语法中的dateTime字段的时间排序。我从实体的上一个“状态”中获取此字段。
要获取我的最后状态,我在GetCurrentState()
实体中定义了方法VisaRequest
;但是当我在let
中调用它时,出现错误。
如何解决?
IQueryable<VisaRequest> visaList = (from visa in context.VisaRequest
let createdDate = EntityFunctions.TruncateTime(visa.CreatedDate)
let dateTime = visa.GetCurrentState().CreateDate.Value.Ticks
where visa.Status != Status.Created &&
visa.Status != Status.Pending)
orderby
createdDate descending, visa.Status descending, dateTime descending
select visa).Skip(skip)
.Take(take);
return visaList.ToList();
我收到此错误:
System.NotSupportedException:LINQ to Entities无法识别方法'Visa.Domain.Entity.FlowState GetCurrentState(Visa.Domain.Entity.FlowState)'方法,并且该方法无法转换为商店表达式。