Simple.Data defines a number of commands for retrieving data from a data store. These can then be daisychained in a LINQ-like fashion with further methods to modify the basic query.


The Allmethod returns all data from a table.


public SimpleQuery All( SimpleExpression criteria )


Type: SimpleExpression
A (concatenated sequence of) search criteria for a group or an aggregate function. For example, db.Albums.AlbumId.Count() > 2.

Return Value

Type: SimpleQuery
A collection of SimpleRecordobjects which can be iterated over.


Exception Condition
BadExpressionException criteriais a malformed SimpleExpression


The Allmethod generally ignores any SimpleExpressions passed to it, be they valid or invalid. The one exception to this rule is when writing a malformed expression using assignment rather than equality checking. For example

var albums = db.Albums.All(db.Albums.GenreId = null)

In this one case, Simple.Data throws a BadExpressionException


The following example returns all the rows of the Albums table and outputs all the album titles to the Console window.

var albums = Database.Open().Albums.All(); foreach (var album in albums) { Console.WriteLine(album.Title); }

Simple.Data sends the following SQL to the database when albums is evaluated.

from [dbo].[Album]  

(which equates to select * from [dbo].[Album])