HLCores.Utilities.Pagination
1.0.0
dotnet add package HLCores.Utilities.Pagination --version 1.0.0
NuGet\Install-Package HLCores.Utilities.Pagination -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HLCores.Utilities.Pagination" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HLCores.Utilities.Pagination --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HLCores.Utilities.Pagination, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HLCores.Utilities.Pagination as a Cake Addin #addin nuget:?package=HLCores.Utilities.Pagination&version=1.0.0 // Install HLCores.Utilities.Pagination as a Cake Tool #tool nuget:?package=HLCores.Utilities.Pagination&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HLCores.Utilities.Pagination
HLCores.Utilities.Pagination is a data pagination utility.
Features
Task<PaginationUtility <T>
> CreateAsync(IQueryable <T>
source, intpageNumber, intpageSize = 10, boolisPaging = true).
PaginationUtility <T>
Create(List <T>
source, intpageNumber, intpageSize = 10, boolisPaging = true).
- source: datas T.
- pageNumber: current page.
- pageSize: size of one page.
- isPaging: is there data pagination (default true).
Usage
Exam:
{
"pagination": {
"totalCount": 0,
"totalPage": 0,
"pageNumber": 0,
"pageSize": 0,
"skip": 0
},
"result": [
]
}
public async Task<PaginationUtility<WardDto>> GetDataPagination(PaginationParam pagination, WardParam param)
{
var predicate = PredicateBuilder.New<Ward>(x => x.IsDelete == false);
if (!string.IsNullOrWhiteSpace(param.Keyword))
{
string keyword = param.Keyword.ToLower();
predicate.And(x => x.Title.ToLower().Contains(keyword) || x.Code.ToLower().Contains(keyword));
}
if (param.DistrictId is not null)
predicate.And(x => x.DistrictId == param.DistrictId);
var data = _context.Ward.Where(predicate)
.Join(_context.District,
x => x.DistrictId,
y => y.Id,
(x, y) => new { Ward = x, District = y })
.Join(_context.Province,
x => x.District.ProvinceId,
y => y.Id,
(x, y) => new { x.Ward, x.District, Province = y })
.MapDataJoin<WardDto>("Ward");
return await PaginationUtility<WardDto>.CreateAsync(data, pagination.PageNumber, pagination.PageSize);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Microsoft.EntityFrameworkCore (>= 7.0.20)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 135 | 8/16/2024 |