So here's what I did
IQueryable
personQuery = from obj in ObjectScope.Extent
select obj;
if (firstName != null)
personQuery = personQuery.Where(person => person.FirstName == firstName);
if (lastName != null)
personQuery = personQuery.Where(person => person.LastName == lastName);
if (middleName != null)
personQuery = personQuery.Where(person => person.MiddleName == middleName);
if (ssn != null)
personQuery = personQuery.Where(person => person.SSN == ssn);
if (city != null)
personQuery = personQuery.Where(person => person.CurrentAddress.City == city);
IList
This is the easy way to do it. I'll show you more advanced ways later.
No comments:
Post a Comment