IDataSet reference

IDataSet<T> represents a table in the database. In general, all database access is performed via an instance of IDataSet<T>.

A DataSet is always connected to a StorageContext and it's not possible to construct a DataSet using new. The only way to access a DataSet is by calling the DataSet<T>() method on a StorageContext object or by declaring a IDataSet<T> field in a subclass of StorageContext.

Datasets are immutable enumerable objects that can be chained using LINQ extension methods. Like most .NET enumerable collections, execution of any database queries is deferred until the collection is enumerated. This also implies that if a dataset is enumerated more than once, it will execute the query every time it is enumerated.

Methods

Method Description
Read() Read a single object from the database
Insert() Insert a single object in the database
Update() Update a single object in the databaae
InsertOrUpdate() Insert or update a single object in the database
Save() Save a single object to the database (alias for InsertOrUpdate())
Supported LINQ methods:

The following methods have specific implementations in Iridium and will usually result in different database queries to be generated:

  • Where()
  • OrderBy() and ThenBy()
  • First() and FirstOrDefault()
  • Last() and LastOrDefault()
  • Skip() and Take()
  • Any()
  • Count()