完整的.net框架中有实体框架LIKE的Q + A&#:
How to do SQL Like % in Linq?
Like Operator in Entity Framework?
例如:
from c in dc.Organization
where SqlMethods.Like(c.Boss, "%Jeremy%")
这在EF Core中不起作用:
当前上下文中不存在名称SqlMethods。
那么你如何使用Entity Framework CORE做一个像?
答案 0 :(得分:8)
LIKE函数已在Core中的EF.Functions
下移动:
from c in dc.Organization
where EF.Functions.Like(c.Boss, "%Jeremy%")
答案 1 :(得分:1)
您可以使用Like
Contains
功能
from c in dc.Organization
where c.Boss.Contains("Jeremy")