Fixes HasNextPage default implementation in older compiler versions

This commit is contained in:
Serraniel 2023-02-28 13:45:17 +01:00
parent 4d3a8002a8
commit adc051ff48
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3
2 changed files with 11 additions and 0 deletions

View file

@ -25,6 +25,13 @@ public class EnumerableApiResponse<T> : IApiResponse<IEnumerable<T>>,
int IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>.Count { get; set; } int IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>.Count { get; set; }
#if !(NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER)
bool IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>.HasNextPage()
{
return ((IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>)this).Page < ((IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>)this).TotalCount;
}
#endif
int IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>.TotalCount { get; set; } int IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>.TotalCount { get; set; }
async Task<EnumerableApiResponse<T>> IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>. async Task<EnumerableApiResponse<T>> IPageableApiResponse<EnumerableApiResponse<T>, IEnumerable<T>>.

View file

@ -15,10 +15,14 @@ public interface IPageableApiResponse<TResponseType, TResponseGeneric>
int TotalCount { get; set; } int TotalCount { get; set; }
#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
bool HasNextPage() bool HasNextPage()
{ {
return Page < TotalCount; return Page < TotalCount;
} }
#else
bool HasNextPage();
#endif
void RememberRequestUri(string requestUri); void RememberRequestUri(string requestUri);