Garnet.Detail.Pagination.ListExtensions
0.1.2
See the version list below for details.
dotnet add package Garnet.Detail.Pagination.ListExtensions --version 0.1.2
NuGet\Install-Package Garnet.Detail.Pagination.ListExtensions -Version 0.1.2
<PackageReference Include="Garnet.Detail.Pagination.ListExtensions" Version="0.1.2" />
paket add Garnet.Detail.Pagination.ListExtensions --version 0.1.2
#r "nuget: Garnet.Detail.Pagination.ListExtensions, 0.1.2"
// Install Garnet.Detail.Pagination.ListExtensions as a Cake Addin #addin nuget:?package=Garnet.Detail.Pagination.ListExtensions&version=0.1.2 // Install Garnet.Detail.Pagination.ListExtensions as a Cake Tool #tool nuget:?package=Garnet.Detail.Pagination.ListExtensions&version=0.1.2
Garnet Pagination
Dotnet library to facilitate applying pagination along with filtering and ordering to a list of objects.
Garnet.Standard.Pagination
dotnet add package Garnet.Standard.Pagination
The idea behind standard packages is not to mess with the domain or application layer with implementation details and keep it clean.
Therefore Garnet.Standard packages consists of abstractions.
Garnet.Pagination
dotnet add package Garnet.Pagination
Implementation of the Garnet.Standard.Pagination
Register to DI container
To use with default configurations:
services.AddGarnetPagination();
Customer configurations can be used either from IConfiguration
or directly passing configurations objects to other
overloads methods.
Garnet.Detail.Pagination.Asp
dotnet add package Garnet.Detail.Pagination.Asp
Facilitates using pagination in web application projects by enabling getting pagination requests as an action input and response the result after applying the pagination.
Register to DI container
To use with default configurations:
services.AddGarnetPaginationAsp();
Custom configurations can be used either from IConfiguration
or directly passing configurations objects to other
overloads methods.
services.AddGarnetPaginationAsp(configuration);
Or
services.AddGarnetPaginationAsp(paginationConfig: new PaginationConfig
{
DefaultPageSize = 20
},
paginationAspRequestConfig: new PaginationAspRequestConfig
{
FilterParameterName = "filter",
OrderParameterName = "order"
});
Using in the action
[Route("[controller]")]
public class MyController : ApiController
{
[HttpGet]
public ActionResult<IReadOnlyList<ObjectDto>> GetAll([FromQuery] IPagination pagination)
{
IPagedElements<object> objects = _objectRepository.GetAll(pagination);
return objects.ToPaginationWithHeaderObjectResult();
}
}
http://localhost/api/my?page=1&&size=10&&filter=prop1==value&&order=id:ASC
ToPaginationWithHeaderObjectResult()
extension method returns an ObjectResult with the list of elements and header
field for total number of elements
Garnet.Detail.Pagination.ListExtensions
dotnet add package Garnet.Detail.Pagination.ListExtensions
Some extension methods to use over IQueryable<T>
or IList<T>
This is using Dynamic Linq library for filtering and ordering which means nested property (
by dot '.') filtering or ordering is also supported like filters=prop1.prop2==value
IQueryable<Model> model = _modelRepository.GetModels();
IPagedElements<Model> pagedModel = await model.ToPagedResultAsync();
Configure
Use either of UseGarnetPaginationIQueryable
overload methods to get required configurations objects from DI
already registered or pass instantly.
applicationBuilder.UseGarnetPaginationListExtensions();
IIQueryableAsyncMethods
Implement this interface to use IQueryable async extension methods from other libraries like EntityFramework
public class EfIQueryableAsyncMethods : IIQueryableAsyncMethods
{
public Task<List<TElement>> ToListAsync<TElement>(IQueryable<TElement> queryable)
{
return queryable.ToListAsync();
}
public Task<long> LongCountAsync<TElement>(IQueryable<TElement> queryable)
{
return queryable.LongCountAsync();
}
}
applicationBuilder.UseGarnetPaginationListExtensions(new EfIQueryableAsyncMethods());
Default Configs
PaginationConfig
Config Name | Default Value |
---|---|
StartPageNumber | 1 |
DefaultPageSize | 20 |
MaxPageNumber | 2147483647 (int.MaxValue) |
MaxPageSize | 2147483647 (int.MaxValue) |
PaginationFilterConfig
Config Name | Default Value |
---|---|
FilterExpressionSeparatorSign | && |
GreaterThanOrEqualSign | >= |
LessThanOrEqualSign | ⇐ |
EqualSign | == |
NotEqualSign | != |
GreaterThanSign | > |
LessThanSign | < |
LikesSign | :: |
ZeroOrMoreCharactersWildCardSign | % |
InListSign | [] |
InListSeparatorSign | , |
PaginationOrderConfig
Config Name | Default Value |
---|---|
OrderFieldAndTypeSeparator | : |
AscendingSign | ASC |
DescendingSign | DESC |
PaginationAspRequestConfig
Config Name | Default Value |
---|---|
PageNumberParameterName | page |
PageSizeParameterName | size |
FilterParameterName | filter |
OrderParameterName | order |
PaginationAspResponseConfig
Config Name | Default Value |
---|---|
HeaderTotalNumberOfElementFieldName | X-Total-Count |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Garnet.Pagination (>= 0.1.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- System.Linq.Dynamic.Core (>= 1.2.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.