This project is read-only.


A set of classes are defined during the data modelling phase(s) of a project:

public class Person: Table
   public virtual int Id {get; set;}

   public string Names {get; set;}

   public Nullable<DateTime> DateOfBirth {get; set;}

Additions and changes to the data model are deployed to the underlying database

var context = new SqlContext("ConnectionName");
var deployment = new SqlDeployment(context);
deployment.DeploymentMode = DeploymentMode.Update; //Preserve existing data
deployment.DeploymentType = DeploymentType.Deploy;


Person instances are manipulated using methods inherited from the underlying Table class (classes can implement an interface if preferred) and a Command object:

var command = context.CreateCommand();

var person = new Person();
person.Id = 1;
person.Names = 'James Doe';

var person2 = new Person();
person2.Id = 1;
person2.DateOfBirth = '23 April 1974';

The Query<T> class can be used to return multiple instances of objects, with grouping filtering and sorting, as well as supporting joins to other queries.

var personQuery = new Query<Person>();

using (QueryDataAdapter adapter = personQuery.Execute(command))
   while (adapter.Read())

Next Advanced Features

Last edited Jan 28, 2010 at 10:45 PM by JamesWestgate, version 23


No comments yet.