Custom Columns
. Select ( p = > New with SQL column name as column name )
Below is
yourself in writing code examples, queries, pagination, where conditions, sorting
var where=NewWhere<incom_terminalfault>(); where. and (a=>a.sa==1); where. And<x_car_database> ((a, b) = = B.carnumbersid. Like ("2")); DataTable Table= db.context.from<incom_terminalfault>() . Select (P= >New{test = P.carid})//query custom columns with SQL column name as new column name// . Select (incom_terminalfault._. All, x_car_database._. CARNUMBERSID) Query the original column. Leftjoin<x_car_database> ((a, b) = = A.carid = = b.id)//left connection, lambda expression, with SQL on A.carid=b.id. Where (where)//Filter Conditions. (Incom_terminalfault._. STARTTIME. DESC)//Sort. Page (Ten,2)//page Out. Todatatable ();
Query example (lambda expression notation):
Db. Context.from<dos.model.tablename>() . Select (d=New{d.id, d.price})//Select Id,price from TableName. Where (d = (D.id = =2&& D.name! ="Itdos"&& d.name.in ("com","Net","cn") && ) || D.sex! =NULL) //where (id=2 and name<> ' Itdos ' and Name in (' com ', ' net ', ' CN ')) or Sex are not null. GroupBy (d =New{d.name, d.sex})//GROUP BY Name,sex. (d =New{d.createtime, d.name})//ORDER BY Createtime,name. Having (d = d.name! ="')//Having name<> '. Top (5) . Page (Ten,2)//page return results per page 10 article return to the 2nd page of data. ToList ();//return to List of entities//. Tofirst (); //returns the first entity//. Tofirstdefault (); //returns the first entity and, if NULL, a default instantiation of a//. Todataset (); //return DataSet//. Todatareader (); //back to IDataReader//. Todatatable (); //Back to DataTable//. Toscalar (); //returns a single valueView Code
Note:
Dosorm additions and deletions should be found in http://www.itdos.com/Dos/ORM/BaseOperate.html
Dos.orm Select queries Custom columns