forked from simplefx/Simple.OData
-
Notifications
You must be signed in to change notification settings - Fork 200
Retrieving all data from a collection
object edited this page Oct 4, 2012
·
28 revisions
Simple.Data method All is used to retrieve all data from a collection.
Retrieve all products:
IEnumerable<dynamic> products = _db.Products.All(); Assert.NotEmpty(products);
Retrieve all order details using different naming convention for OrderDetails collection:
IEnumerable<dynamic> orderDetails = _db.Order_Details.All(); Assert.NotEmpty(orderDetails);
Retrieve product total count:
var count = _db.Products.All().Count(); Assert.True(count > 0);
Retrieve all products with total count in a single operation:
Promise<int> count; IEnumerable<dynamic> products = _db.Products.All().WithTotalCount(out count).Take(1); Assert.NotEmpty(products); Assert.True(count > 1);
See also:
Simple.Data documentation for All