如何在实体框架CORE中做一个LIKE(不完整的.net)

Jer*_*son 6 c# sql-server entity-framework-core .net-core

在Full .net框架中有实体框架LIKE的Q + A:

如何在Linq中使用SQL Like%?
与实体框架中的运营商一样?

例如:

from c in dc.Organization
where SqlMethods.Like(c.Boss, "%Jeremy%")
Run Code Online (Sandbox Code Playgroud)

这在EF Core中不起作用:

名称SqlMethods在当前上下文中不存在.


那么你如何使用Entity Framework CORE做一个像?

Jer*_*son 11

LIKE函数已EF.Functions在Core中移动:

from c in dc.Organization
where EF.Functions.Like(c.Boss, "%Jeremy%")
Run Code Online (Sandbox Code Playgroud)