旧项目的两段代码移到新项目,这种在实体中定义逻辑的写法就报错了,不知道为什么,新项目的EF是3.14,旧项目的EF是2.14
if (_couponManager.GetAllCustomerCouponsRL()
.Any(m => couponIdList.Contains(m.CouponId) && !m.GetIsUse))
{
map.IsHaveCoupon = true;
}
else
{}
public class CouponCustomerRL : Effective_BaseSanyuanGroupPurchaseEntity<Guid>, IHasModificationTime
{
...
public bool GetIsUse
{
get
{
if (this.IsLock) return true;
return this.IsUse;
}
}
}
错误信息
Mvc.ExceptionHandling.AbpExceptionFilter - The LINQ expression 'DbSet<CouponCustomerRL>
.Where(c => __ef_filter__p_0 || !(((ISoftDelete)c).IsDeleted))
.Any(c => (Nullable<Guid>)c.CustomerId == __input_CustomerId_0 && __couponIdList_1.Contains(c.CouponId) && !(c.GetIsUse()) && DateTime.Now > c.StartTime && DateTime.Now < c.EndTime)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.