Because the work is often used in the SQLite database, but can not find a good orm so self-organized a simple and easy to use the light-weight ORM Framework: Easyliter
Feature Description:
1. Support SQL statement operation
2, Support List<t> and DataTable two return format
3, support lambda expression display for data query and paging
4. Built-in entity class function
5. Dependent on System.Data.SQLite
Here's how to use it:
Static voidMain (string[] args) { varConnStr ="datasource="+ System.AppDomain.CurrentDomain.BaseDirectory +"Mapping.sqllite"; //dependent on the System.Data.SQLiteEasyliter e =NewEasyliter (CONNSTR); //To create a class from a database varCreateCalss1 = E.CREATECALSS ("Sqlite.model"/*name Space*/,@"d:\ Work \sqlite\sqlite\model"/*Path*/); //create a class from a SQL statement, and a multi-table query will use varCreateCalss2 = E.createcalssbysql ("Sqlite.model",@"d:\ Work \sqlite\sqlite\model","viewproduct","Select Id,sku from Product"); //Delete//e.delete<product> (100); //e.delete<product> (new int [] {n/a}); //Update//e.update<product> (New {sku = "x2", category_id=1}, new {id=434}); ////Add //Product P = new Product ()//{ //category_id = 2,//SKU = "SKU",//title = "title"//}; //e.insert<product> (p); ////based on SQL querylist<product> list = e.select<product> ("SELECT * from product where id> @num",New{num= - }); //Unconditionallist<category> List2 = e.select<category>(); //Single ConditionList<product> list3 = e.select<product> (x=>x.id> $); //Multi-Criterialist<product> List4 = e.select<product> (x = x.id > $, x= x.sku=="skx"|| x.sku==NULL); //Multi-condition paging intCount =0; List<Product> list5 = e.selectpage<product> (1,Ten,refCount"ID desc", x=>x.id >Ten,//Condition 1X=>true);//Condition 2 ... Condition N//var dt = e.getdatatable ("SELECT * from product ORDER BY id DESC"); }
Source Address:Http://git.oschina.net/sunkaixuan/Easyliter
The. NET C #-based SQLite database ORM "Easyliter"