I have a LINQ to ENTITY query that pulls from a table, but I need to be able to create a \"fuzzy\" type search. So I need to add a where clause that searches by lastname IF
I think you want to use the Contains()
function of the string parameter like this:
var query = from mem in context.Member
where mem.LastName.Contains("xxx")
orderby mem.LastName, mem.FirstName
select new
{
FirstName = mem.FirstName,
LastName = mem.LastName,
};
I think you can also use StartsWith()
and EndsWith()
which would be equivalent to the SQL 'xxx%' and '%xxx" respectively.