c# - Comprehensive sorting/paging/filtering service layer interface method -


I am trying to write a service level method which will take all necessary parameters that will allow me to get data on how to The webform grid will work.

The repository return IQueryable & lt; T & gt; .

I came up with a model like this:

  Public Class PagedModel & lt; T & gt; {Public GridSortOptions GridSortOptions {get; Set; } // ANCT for ANC and DESC Public ILIST & gt; T & gt; Item {get; Set; } {Get full public page}; Set; } Public int PageSize {get; Set; }}   

Method:

  Page_Document & lt; Users & gt; GetUsers (expression & lt; Func & lt; T, bool & gt; built, int page, int pageisms, gridstort option sorting);   

Question:

  1. What are the parameters I am missing from this method?
  2. Is the project unavailable from PagedModel?
  3. How do I apply the method?

    What do I need:

    1. paging
    2. sorting
    3. filtering

      I always like to create a "criterion" class is different from the list of all the items in which you Are searching. In this way you can use it as a model property which will automatically be bound to your search functions, send it to service and repository systems (instead of different params), continue in session, if If needed, the current type is specific to what you are looking for (i.e. user), general endorsement or a supertype for sorting.

        Public class UserCriteria {public GridSortOptions GridSortOptions {Received; Set; } // ANSc for ANC and DESC Public Int page; Set; } Public int PageSize {get; Set; } Public bool? Receive {Receive} Set; } Public String Username {get; Set; }}    

Comments