dk5chiyou 注册会员
2023-02-28 16:22

This answer quotes ChatGPT

This error message is because EF Core 3.14 has query tracing enabled by default and does not support converting method calls into SQL queries. In older projects, EF Core 2.14 May not have query tracing enabled or may have converted method calls.

You can try inserting the ToList() method into the query to convert the query into a memory query to resolve the error. For example:

if (_couponManager.GetAllCustomerCouponsRL()
               .Any(m => couponIdList.Contains(m.CouponId) && !m.GetIsUse))
    map.IsHaveCoupon = true;
    // ...

Inserting the ToList() method into the query can turn the query into an in-memory query, but it is important to note that doing so can cause performance problems, especially if the amount of data is large. If you need to query large amounts of data, it is recommended to use transformation-enabled queries or optimized queries.