net*_*fan 6 postgresql npgsql ef-core-3.1
我已经在 Npgsql and Entity Framework Query PostgreSQL with Npgsql and Entity Framework using unaccent中读到过有关此内容,但实体框架核心。
\n\n是否可以使用 EF CORE 3.1 使用非重音扩展对 postgresql 进行选择?
\n\n如何翻译,例如
\n\n\n\n\nselect * from users where unaccent(name) = unaccent(\'Jo\xc3\xa3o\')
\n
使用 EF core 和 npgsql 到 .net core 3.1
\n\n谢谢
\n解决方案在这里: Query PostgreSQL with Npgsql and Entity Framework using unaccent
首先注册扩展:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasPostgresExtension("unaccent");
...
}
Run Code Online (Sandbox Code Playgroud)
然后你可以使用扩展EF.Functions.Unaccent:
.Where(x => people.ILike(EF.Functions.Unaccent(x.Name)....
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
455 次 |
| 最近记录: |