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
Add your "select new" to the query only after you append your "Where" clause.
Hence append your select clause using object call syntax as you did with the where clause.
Untested, please excuse small errors, but the general concept would be....
using( someContent sc = new someContent())
{
var query = sc.Member.OrderBy( i => i.LastName)
.ThenBy( i => i.FirstName);
sLastName = formCollection["FuzzyLastName"].ToString();
if (!String.IsNullOrEmpty(sLastName))
query = query.Where(ln => ln.LastName.Contains(sLastName));
query = query.Select( i => new
{
FirstName = i.FirstName,
LastName = i.LastName,
});
}