This project is read-only.

Instantiate a DataSession

//provider for MS-SQL
Anito.Data.SqlClient.SqlProvider provider = new Anito.Data.SqlClient.SqlProvider();
provider.ConnectionString = "ConnectionString";
ISession session = new DataSession(provider);

Basic Get

Assuming that Entity is an anito mapped object.
//Get by key
Entity entity1 = session.GetT<Entity>("ENT-000123");

//Get by expression
Entity entity2 = session.GetT<Entity>(x => x.EntityCode == "ENT-000123");

//List
List<Entity> list1 = session.GetList<List<Entity>, Entity>();

List<Entity> list2 = session.GetList<List<Entity>, Entity>(e => e.ID < 100);

//Paged
List<Entity> pagedList = session.GetPagedList<List<Entity>, Entity>(10, 3);

Basic Insert

Entity entity = new Entity();
entity.EntityCode = "ENT00001";
entity.Name = "John Doe";
session.Insert<Entity>(entity)

Basic Update

Entity entity = session.GetT<Entity>(e => e.EntityCode == "ENT00001");
entity.Name = "Jane Doe";
session.Update<Entity>(entity, x => x.EntityCode == "ENT00001");

Basic Delete

session.Delete<Entity>(e => e.EntityCode == "ENT00001");

Last edited Mar 29, 2011 at 5:50 AM by mdcuesta, version 8

Comments

No comments yet.