You are limited to a set of canonical functions that can be translated into a SQL query, so any solution must be achieved no more than canonical functions are offered.
Fortunately, one of the supported functions is the instance method bool Contains(string) . You can rewrite your check as
persons = persons.Where(c => c.FullName.Contains(" " + lastNameSearch));
This is not quite like your current version (because it will allow people with multiple names to match their middle name, but the first will not), but it's pretty close, and IMHO might be acceptable.
Of course, it would be much better than any of them to save the last names as a separate column in the database, if at all possible.
Jon
source share