忽略口音,而搜索使用实体框架数据库 [英] Ignoring accents while searching the database using Entity Framework

查看:116
本文介绍了忽略口音,而搜索使用实体框架数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含重音字符的名称的数据库表。像 A 等。

I have a database table that contains names with accented characters. Like ä and so on.

我需要使用EF4从包含一些子<表中的所有记录EM>不管口音的

I need to get all records using EF4 from a table that contains some substring regardless of accents.

所以下面的代码:

myEntities.Items.Where(i => i.Name.Contains("a")); 



应该返回包含名称中的所有项目 A ,还含有所有项目 A 等。这可能吗?

should return all items with a name containing a, but also all items containing ä, â and so on. Is this possible?

推荐答案

如果您设置的名称列的区分重音排序顺序然后根据需要查询应该工作。

If you set an accent-insensitive collation order on the Name column then the queries should work as required.

这篇关于忽略口音,而搜索使用实体框架数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆