C# Class Castle.MonoRail.ActiveRecordSupport.Pagination.AbstractPaginableQuery

Base class for all paginable queries, including custom ones.
Extenders should override the BuildHQL. Optionally, the methods SetQueryParameters and ExecuteQuery can also be overriden.
Inheritance: Castle.ActiveRecord.ActiveRecordBaseQuery, IARPaginableDataSource
Mostrar archivo Open project: nats/castle-1.0.3-mono

Protected Properties

Property Type Description
pageSize int

Public Methods

Method Description
AbstractPaginableQuery ( Type targetType ) : System
ListAll ( ) : IEnumerable
ObtainCount ( ) : int

Executes a query to return the record count

Paginate ( int pageSize, int currentPage ) : IEnumerable

Returns the page items. Actually, the implementation just sets the protected fields pageSize and currentPage, gets an ISession from SessionFactoryHolder and calls InternalExecute in order to execute the custom query and fetch only the page items.

Protected Methods

Method Description
BuildCountHQL ( ) : string
BuildHQL ( ) : string

Should be overriden to return the custom HQL to be ran.

CreateQuery ( ISession session ) : IQuery
ExecuteQuery ( IQuery query ) : IEnumerable

Override to provide a custom query execution. The default behaviour is to just call IQuery.List().

InternalEnumerate ( ISession session ) : IEnumerable

The implementation of the InternalEnumerate method, as required by ActiveRecordBaseQuery. Should not be overriden.

InternalExecute ( ISession session ) : object

The implementation of the InternalExecute method, as required by ActiveRecordBaseQuery. Should not be overriden.

SetQueryParameters ( IQuery query ) : void

May be overriden, in order to set custom query parameters.

Private Methods

Method Description
InternalPaginate ( ISession session, bool skipPagination ) : IEnumerable
PrepareQueryForPagination ( IQuery query ) : void

For internal use only.

Method Details

AbstractPaginableQuery() public method

public AbstractPaginableQuery ( Type targetType ) : System
targetType System.Type
return System

BuildCountHQL() protected method

protected BuildCountHQL ( ) : string
return string

BuildHQL() protected abstract method

Should be overriden to return the custom HQL to be ran.
protected abstract BuildHQL ( ) : string
return string

CreateQuery() protected final method

protected final CreateQuery ( ISession session ) : IQuery
session ISession
return IQuery

ExecuteQuery() protected method

Override to provide a custom query execution. The default behaviour is to just call IQuery.List().
protected ExecuteQuery ( IQuery query ) : IEnumerable
query IQuery The query
return IEnumerable

InternalEnumerate() protected final method

The implementation of the InternalEnumerate method, as required by ActiveRecordBaseQuery. Should not be overriden.
protected final InternalEnumerate ( ISession session ) : IEnumerable
session ISession The NHibernate Session
return IEnumerable

InternalExecute() protected final method

The implementation of the InternalExecute method, as required by ActiveRecordBaseQuery. Should not be overriden.
protected final InternalExecute ( ISession session ) : object
session ISession The NHibernate Session
return object

ListAll() public method

public ListAll ( ) : IEnumerable
return IEnumerable

ObtainCount() public method

Executes a query to return the record count
public ObtainCount ( ) : int
return int

Paginate() public method

Returns the page items. Actually, the implementation just sets the protected fields pageSize and currentPage, gets an ISession from SessionFactoryHolder and calls InternalExecute in order to execute the custom query and fetch only the page items.
public Paginate ( int pageSize, int currentPage ) : IEnumerable
pageSize int The page size
currentPage int The current page
return IEnumerable

SetQueryParameters() protected method

May be overriden, in order to set custom query parameters.
protected SetQueryParameters ( IQuery query ) : void
query IQuery The query
return void

Property Details

pageSize protected_oe property

protected int pageSize
return int