Retrieving all data matching search criteria

object edited this page Dec 1, 2012 · 10 revisions

Simple.Data method FindAll is used to retrieve all data that satisfy search criteria.


Find all products with product category 1

IEnumerable<dynamic> products = _db.Products.FindAll(_db.Products.CategoryID == 1);
Assert.NotEmpty(products);

Request URI: GET Products?$filter=CategoryID+eq+1


Find all products with the length of name equal to 4

IEnumerable<dynamic> products = _db.Products.FindAll(_db.Products.ProductName.Length() == 4);
Assert.NotEmpty(products);

Request URI: GET Products?$filter=length(ProductName)+eq+4


See also:
Retrieving data
Simple.Data documentation for FindAll