I have executed a linq query by using Entityframework like below
GroupMaster getGroup = null;
getGroup = DataContext.Groups.FirstOrDefault(item => keyword.IndexOf(item.Keywords,StringComparison.OrdinalIgnoreCase)>=0 && item.IsEnabled)
when executing this method I got exception like below
LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method, and this method cannot be translated into a store expression.
Contains() method by default case sensitive so again I need to convert to lower.Is there any method for checking a string match other than the contains method and is there any method to solve the indexOf method issue?
DataContext.Groupsobject. - Tolga EvcimenContainsis transformed intoLIKEstatement within generated SQL query. Fact whether thatLIKEis case sensitive or case insensitive depends on database configuration. Change your database to perform case insensitive string comparison and useContains. - MarcinJuraszek