Skip to content

Commit 2476b18

Browse files
committed
Merge remote-tracking branch 'origin/development' into development
2 parents 0b65277 + bc6dd68 commit 2476b18

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

Readme.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ builder.AddGridify(params Assembly[] assemblies);
3838
To efficiently filter and query your Book entity using Gridify, you need to create a mapping class that extends FilterMapper<T>.
3939
This class will define how each property in your Book entity should be mapped.
4040

41-
Here’s an example of how to set up the Book entity and its corresponding mapping class:
41+
Here’s an example of how to set up the Book entity and its corresponding mapping class:
4242
```csharp
4343
public class Book
4444
{
@@ -103,6 +103,16 @@ var pagedResponse = await dbContext.Books
103103
.FilterOrderAndGetPagedAsync(new GridifyQueryModel { PageSize = 10, Page = 1 }, cancellationToken);
104104
```
105105

106+
'GridifyQueryModel' by default has PageSize validation with 500 records. If you want to ignore this validation, you should pass bool 'false' into its constructor, otherwise the validation will be applied into it, and you will not be able to get more records.
107+
```csharp
108+
var gridifyQueryModel = new GridifyQueryModel(false) { PageSize = 10, Page = 1 };
109+
```
110+
111+
As an alternative solution you can use 'SetMaxPageSize()' method to set PageSize into 'int.MaxValue' instead of using constructor parameter.
112+
```csharp
113+
gridifyQueryModel.SetMaxPageSize();
114+
```
115+
106116
Use ColumnDistinctValuesAsync to get distinct values of a specific column:
107117
```csharp
108118
public static async Task<CursoredResponse<object>> ColumnDistinctValuesAsync<TEntity>(

src/GridifyExtensions/GridifyExtensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageReadmeFile>Readme.md</PackageReadmeFile>
99
<Authors>Pandatech</Authors>
1010
<Copyright>MIT</Copyright>
11-
<Version>1.4.0</Version>
11+
<Version>1.4.2</Version>
1212
<PackageId>Pandatech.GridifyExtensions</PackageId>
1313
<Title>Pandatech.Gridify.Extensions</Title>
1414
<PackageTags>Pandatech, library, Gridify, Pagination, Filters</PackageTags>

src/GridifyExtensions/Models/GridifyQueryModel.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ namespace GridifyExtensions.Models
55
{
66
public class GridifyQueryModel : GridifyQuery
77
{
8+
private bool _validatePageSize;
9+
10+
public GridifyQueryModel()
11+
{
12+
_validatePageSize = true;
13+
}
14+
15+
public GridifyQueryModel(bool validatePageSize)
16+
{
17+
_validatePageSize = validatePageSize;
18+
}
19+
820
public new required int Page
921
{
1022
get => base.Page;
@@ -29,7 +41,7 @@ public class GridifyQueryModel : GridifyQuery
2941
throw new GridifyException($"{nameof(PageSize)} should be positive number.");
3042
}
3143

32-
if (value > 500)
44+
if (value > 500 && _validatePageSize)
3345
{
3446
value = 500;
3547
}
@@ -49,5 +61,11 @@ public class GridifyQueryModel : GridifyQuery
4961
get => base.Filter;
5062
set => base.Filter = value;
5163
}
64+
65+
public void SetMaxPageSize()
66+
{
67+
_validatePageSize = false;
68+
PageSize = int.MaxValue;
69+
}
5270
}
5371
}

test/GridifyExtensions.Demo/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public class SomeController : ControllerBase
2828
[HttpGet("test")]
2929
public IActionResult Get([FromQuery] GridifyQueryModel request)
3030
{
31+
var t = new GridifyQueryModel(false)
32+
{
33+
Page = 1,
34+
PageSize = int.MaxValue
35+
};
3136
return Ok(request);
3237
}
3338
}

0 commit comments

Comments
 (0)