var info = new List<string>();
ef 查询语句
query.Where(x => info .Contains(x.Barcode))
报错 $ 附近错误
这是 ef 为了兼容 ,把查询语句转成了 类似下方语句
where barcode in( SELECT 1
FROM OpenJson(@__names_0) AS)
解决方法: 重点是添加 o => o.UseCompatibilityLevel(120) 兼容2014数据库
builder.Services.AddDbContext<BaseDbContext>(option =>
{
option.UseSqlServer(builder.Configuration.GetConnectionString("BaseDbContext"), o => o.UseCompatibilityLevel(120));
});
标签:ef8,语句,ef,Contains,UseCompatibilityLevel,查询,报错 From: https://www.cnblogs.com/Wangshh/p/18102797