Hi and sorry for the late answer,
Using shearch-Criteria classes is commonly used in prjects.
You can create a search class for each Data access object.
Here is a little example :
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public string Adress { get; set; }
public DateTime BirthDate { get; set; }
}
public class SearchPerson
{
public int Id { get; set; }
public string Name { get; set; }
public string Adress { get; set; }
public int Age { get; set; }
}
public class PersonDal
{
public Person GetPersonById(SearchPerson searchCriteria)
{
}
public List<Person> GetListPersonByAge(SearchPerson searchCriteria)
{
}
}
PersonDal pDal = new PersonDal ();
Person person1 = pDal.GetPersonById(new SearchPerson{Id = 5});
List<Person> personList = pDal.GetListPersonByAge(new SearchPerson{Age = 20});
You can then add properties to your search class without changing any old code.
CONS :
You will in general use only few fields/Prop of the SearchClass, to know the exact prop to fill, you should go back and check the code each time, thats why method naming is really important, it helps figure out the fields to use.
More :
You can think about a BaseSearchCriteria class for common functionality...
Hope it helps.