如何将 Postgres 查询转换为 Entity Framework Where 子句

How to Translate Postgres query to Entity Framework Where Clause

如何将以下 Postgresql 查询转换为 Entity Framework 核心 Where 子句?

select title from some_table where title ~ '[^[:ascii:]]';

~ 是使用正则表达式进行模式匹配的运算符。 Npgsql EF Core 提供程序自动翻译 .NET 的 Regex.IsMatch 因此您可以尝试使用它:

context.SomeTable
    .Where(t => Regex.IsMatch(t.Title, "[^[:ascii:]]"))
    ...