[英]How to do a LIKE in Entity Framework CORE (not full .net)
完整的 .net 框架中有实体框架 LIKE 的 Q+A:
如何在 Linq 中执行 SQL Like %?
像实体框架中的运算符?
例如:
from c in dc.Organization
where SqlMethods.Like(c.Boss, "%Jeremy%")
这在 EF Core 中不起作用:
当前上下文中不存在名称 SqlMethods。
那么如何使用 Entity Framework CORE 执行 LIKE 操作呢?
LIKE 函数已移至 Core 中的EF.Functions
下:
from c in dc.Organization
where EF.Functions.Like(c.Boss, "%Jeremy%")
您可以使用Contains
而不是Like
函数
from c in dc.Organization
where c.Boss.Contains("Jeremy")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.