Datarabbit lightweight data access framework (10) -- ipagermanager

Source: Internet
Author: User
(Fully qualified class name: Datarabbit. Core. ipagermanager )

The datarabbit framework provides the function of paging the results of a single table query, which is the goal of ipagermanager. We can get ipagermanager reference from idataaccesser, the entry point of datarabbit: 

PagerparametersParam =...; // construct paging Parameters
IpagermanagerPagermanager = Dataaccesser. getpagermanager ( Param );

First, let's look at the paging parameters.PagerparametersRequired information:

The paging parameters include:
Table -- indicates that the data table is paged.
Pagesize -- the size of each page, including the number of records.
Pkey -- indicates which primary key is used for sorting by page.
Wherestr -- indicates the query condition. Only the query results that meet the condition are displayed on the page. If you want to list all data in the table on the page, set it to its value null.
Cachersize -- indicates the maximum number of pages cached.
Fields -- indicates which columns are included in the page to return.
Fieldalias -- the alias of the column to be replaced.

By building Pagerparameters You can obtain the ipagermanager instance of the data page manager of the target table from idataaccesser. The ipagermanager interface is completely defined as follows: Public   Interface Ipagermanager
{
///   <Summary>
/// Getpage retrieves the index page
///   </Summary>
DatatableGetpage ( Int Index );

/// <Summary>
///Itemcount total number of qualified records
/// </Summary>
IntItemcount {Get;}

//


// total pagecount pages
//
int pagecount { Get ;}

//


// cachersize cache size
//
int cachersize { Get ;}< BR >}

Through interface definition, we can see that ipagermanager does not inherit the itransactionaccesser interface, which indicates that ipagermanager can only work in a non-transaction environment.
The getpage () method obtains the content of the corresponding page based on the index of the page. Note that we use datatable to reflect the content of one page.

The following is an example of paging the student table and binding the page to the datagridview display: PagerparametersPara =   New Pagerparameters ( " Student " , " ID " , "" , 10 );
IpagermanagerPagermanager = Dataaccesser. getpagermanager (para );

// Bind
This. Datagridview1.datasource=Pagermanager.Getpage(Int. Parse (This. Textbox_pageindex.text ));

Go to: datarabbit lightweight data access framework-Sequence

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.