How to stay DRY whilst using LINQ to Entities and helper methods?
问题 Lets say that I have a particular way of deciding whether some strings "match", like this: public bool stringsMatch(string searchFor, string searchIn) { if (string.IsNullOrEmpty(searchFor)) { return true; } return searchIn != null && (searchIn.Trim().ToLower().StartsWith(searchFor.Trim().ToLower()) || searchIn.Contains(" " + searchFor)); } I would like to pull matches out of a database using Linq To Entities and this helper. However, when I try this: IQueryable<Blah> blahs = query.Where(b =>