MVC Architecture introduction-query function development and mvc Architecture query Development

Source: Internet
Author: User

MVC Architecture introduction-query function development and mvc Architecture query Development

  • Select and from statements

Note:
Select and from can be left unspecified. By default:
Select to obtain all fields in the ing table;
From obtains the table name of the object ing table;
If select is set, frorm must be set, but only from can be set without select

  • Where statement

  • Set parameters

Set parameters by @ number, for example:

Define naming Parameters

  • To implement an in statement, you can only use named parameters, for example:

  • Order by statement

  • You can also use Append to build SQL statements more flexibly.

  • If you need to execute multiple SQL statements, you should put these statements into the set and execute them using the corresponding method.

 

Paging query:

Call the GetPagingEntities method in the derived Repository to obtain the paging data and return the encapsulated paging set by PagingDataSet <T>.
For example:

 

Non-Paging query:

Call the GetTopEntities method in the derived Repository to obtain the first N data sets and return the IEnumerable <T> type data set.

For example:

 

 

Instance product based on asp.net mvc 5.0 framework, source code: http://www.jinhusns.com/Products/Download

Related Article

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.