EF Core中的多个条件(按OR)

时间:2018-11-17 13:08:46

标签: entity-framework entity-framework-core core ef-core-2.1

我想在一个字段中搜索几个单词

我的代码

        string[] tags = key.Split(' ');
        foreach (var tag in tags)
        {
            result = result.Where(EF.Functions.FreeText(n.Article, tag));
        }

此查询在sqlserver上运行(通过 AND

(((FREETEXT([n].[Article], @__tag_1)) AND (((FREETEXT([n].[Article], @__tag_2)) AND (((FREETEXT([n].[Article], @__tag_3))

但是我想要此查询(通过 OR

(((FREETEXT([n].[Article], @__tag_1)) OR (((FREETEXT([n].[Article], @__tag_2)) OR (((FREETEXT([n].[Article], @__tag_3))

如何修复

谢谢

0 个答案:

没有答案