Created
November 9, 2009 20:36
-
-
Save jfromaniello/230259 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IPaginatorModel<TEntity> where TEntity : Entity | |
{ | |
ICollection<TEntity> GetPage(int pageSize, | |
int pageNumber, | |
Expression<Func<TEntity, bool>> filterFunction, | |
Func<TEntity, object> sortFunction); | |
int GetPageCount(int pageSize, | |
Expression<Func<TEntity, bool>> filterFunction); | |
} | |
//The implementation: | |
[PersistenceConversational(MethodsIncludeMode = MethodsIncludeMode.Implicit)] | |
public class PaginatorModel<TEntidad> : IPaginatorModel<TEntidad> where TEntidad : Entity | |
{ | |
private readonly IDaoReadOnly<TEntidad> _dao; | |
public ModeloListar(IDaoFactory daoFactory) | |
{ | |
_dao = daoFactory.GetDaoReadOnlyOf<TEntidad>(); | |
} | |
#region IPaginatorModel<TEntidad> Members | |
[PersistenceConversation(ConversationEndMode = EndMode.End)] | |
public virtual ICollection<TEntidad> GetPage( | |
int pageSize, int pageNumber, | |
Expression<Func<TEntidad, bool>> filterFunction, | |
Func<TEntidad, object> sortFunction) | |
{ | |
return _dao | |
.Retrieve(predicado) | |
.OrderBy(sortFunction) | |
.Skip(pageSize * pageNumber) | |
.Take(pageSize).ToList(); | |
} | |
[PersistenceConversation(ConversationEndMode = EndMode.End)] | |
public virtual int GetPageSize( | |
int pageSize, | |
Expression<Func<TEntidad, bool>> filterFunction) | |
{ | |
//balbalblalbal | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment