gpt4 book ai didi

c# - 如何在 Entity Framework CORE 中执行 LIKE(不是完整的 .net)

转载 作者:太空狗 更新时间:2023-10-29 21:03:58 26 4
gpt4 key购买 nike

完整的 .net 框架中有针对 Entity Framework 的问答:

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 中不起作用:

The name SqlMethods does not exist in the current context.

那么如何使用 Entity Framework CORE 进行 LIKE 呢?

最佳答案

LIKE 函数已移至核心中的 EF.Functions 下:

from c in dc.Organization
where EF.Functions.Like(c.Boss, "%Jeremy%")

关于c# - 如何在 Entity Framework CORE 中执行 LIKE(不是完整的 .net),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47277630/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com