subsonic 3.0 dynamic search query
I want to build dynamic search query with s开发者_StackOverflow社区ubsonic 3.0. who can help me? Any sample Please.
Basically all you need to do is add conditions to an IQueryable based on your dynamic parameters. For example:
string productName = Request.Querystring[ProductName];
IQueryable<Product> productQuery = Product.All();
if(productName != null)
{
productQuery = productQuery.Where(product => product.Name == productName);
}
IList<Product> filteredList = productQuery.ToList();
精彩评论