c# - Pagination using Entity Framework through Web API -


i have class this:

public class be_categorybase {     public int32 categoryid { get; set; }     public string categoryname     {         get;         set;     }     public string categorysanitized { get; set; }     public boolean isactive { get; set; }     public datetime? modificationdate { get; protected set; }     public int64? modifiedby { get; set; } } 

in web api have action method this.

so far fetching records server in single request. above api call post because there many filters being used. has limited length in query string...so used post.

[route("api/v1/categorylist"), httppost] public async task<ihttpactionresult> categorylist([frombody]be_category obj) {     var result = await _category.categorylist(obj);      if (!string.isnullorempty(result.key))         await _log.createlog(new be_logs { message = result.key });      return ok(new { errormessage = result.key, result = result.value }); } 

now, in order use paging, thinking of adding startpage , pagesize columns in be_categorybase class. using entity framework code first, adding column in class add these columns in database table also.

is there elegant way implement paging post action method ?

notmapped looking for. hope surely somebody.

public class paging {     [notmapped]     public int16 startpage { get; set; }      [notmapped]     public int16 pagesize { get; set; } }   public class be_categorybase : paging {     public int32 categoryid { get; set; }     public string categoryname { get; set; }     public string categorysanitized { get; set; }     public boolean isactive { get; set; }     public datetime? modificationdate { get; protected set; }     public int64? modifiedby { get; set; } } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -