Dos.orm Select queries Custom columns

Source: Internet
Author: User

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 value
View Code

Note:

Dosorm additions and deletions should be found in http://www.itdos.com/Dos/ORM/BaseOperate.html

Dos.orm Select queries Custom columns

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.