看起来EF无法在以下代码中翻译快递,这是调用
Counter lastCounter = unitOfWork.CounterRepository.FindLast(x => x.Div == counter.Div, x => x.Div);
这是方法
public Counter FindLast(Expression<Func<Counter, bool>> predicate, params Expression<Func<Counter, object>>[] includedProperties)
{
IQueryable<Counter> set = context.Set<Counter>().Where(predicate);
foreach (var includeProperty in includedProperties)
{
set = set.Include(includeProperty);
}
return set.Last();
}
知道可能是什么问题吗?
答案 0 :(得分:0)
这非常简单,实际上:实体框架不支持Last().
原因是在SQL中,你也无法选择最后一个元素(即你有SELECT TOP
但是没有SELECT BOTTOM
)。