ardalis / Result

A result abstraction that can be mapped to HTTP response codes if needed.
MIT License
866 stars 107 forks source link

Pagination option #47

Closed HamedFathi closed 3 years ago

HamedFathi commented 3 years ago

I am not sure but, what if we have a paged info property in Result class?

public class Result
{
    // ...
    public PagedInfo<T> PagedInfo { get; set; } = null;
    // ...
}

public class PagedInfo<T>
{
    public long PageNumber { get; set; }
    public long PageSize { get; set; }
    public long TotalPages { get; set; }
    public long TotalRecords { get; set; }
}

I think it covers paging scenarios too.

ardalis commented 3 years ago

Could be useful. I'm not sure you'd always want it, though, so maybe an alternate PagedResult base type?

HamedFathi commented 3 years ago

so maybe an alternate PagedResult base type

Looks good, Should it be part of your library or just a simple inheritance on the user side?

ardalis commented 3 years ago

I'd consider a PR with it, if you included some tests and sample usage. You open to that?

HamedFathi commented 3 years ago

Probably, Give me some time to try it.

ardalis commented 3 years ago

How's it coming?

HamedFathi commented 3 years ago

Sorry, I was sick for a while. I do it in my free time.

ShadyNagy commented 3 years ago

@ardalis & @HamedFathi
Is that we are looking for PR #52