If i have to design a site which give different type of search criteria and it keeps on changing, is there some pattern i need to follow?.
For example, i have a search criteria to search by Category. Later on i decide to put an extra criteria to search by price. It can have combinations too for the above criteria. After some time i add one more criteria, search by location, but then i need to keep on changing the class that is returning me the result.
public List<Product> GetProducts(SearchCriteria search){
//code
}
public class SearchCriteria{
public string Category{get;set;}
public double Price{get;set;}
}
So if i need to add another criteria, i need to change the SearchCriteria class and the GetProducts method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.