i need to perform a search on over a table whit a string field that contains accents (á, ì, ü, etc) im using EF 6
first i try i direct search like:
var listaResultados = db_hms.Topology
.Where( t => t.is_active == true && ((t.display_name.Contains(busqueda))||(t.detail.Contains(busqueda))))
but this is accent sensitive, then i try this:
t.display_name.IndexOf(busqueda, StringComparison.InvariantCultureIgnoreCase) >= 0
but is not supported on linq to Entities
any other idea please pd: i need to perform the search on a "Contains" way, not a starts whit.
These comparisons will depend on collation you selected when creating your SQL Server Database. I don't know if the EF has any workarounds but you can possibly get around this using a stored procedure to invoke something along the lines of this:
How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.