Skip to content

Retrieving all data matching search criteria

object edited this page Oct 4, 2012 · 10 revisions

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

Find all products with product category 1:
OData URI: Products?$filter=CategoryID+eq+1

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

Find all products with the length of name equal to 4:
OData URI: Products?$filter=length(ProductName)+eq+4

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

See also:
Simple.Data documentation for FindAll