You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to Pandatech.GridifyExtensions! This library builds on top of the popular Gridify package, adding new
4
-
functionalities and simplifying its use for data filtering and pagination in .NET applications.
3
+
Welcome to **Pandatech.GridifyExtensions**! This library extends the
4
+
powerful [Gridify](https://github.com/alirezanet/Gridify) package, providing additional functionalities and a more
5
+
streamlined API for data filtering, ordering, and pagination in .NET applications.
5
6
6
-
## Why Use Pandatech.GridifyExtensions?
7
+
## Why Choose Pandatech.GridifyExtensions?
7
8
8
-
Gridify is a powerful tool for querying and filtering data. However, integrating it into your projects can sometimes
9
-
involve repetitive code and extra setup. Pandatech.GridifyExtensions aims to make your development process smoother by
10
-
offering:
9
+
Gridify is great for dynamic querying, but incorporating it into projects can sometimes be repetitive or involve extra
10
+
setup. **Pandatech.GridifyExtensions** makes this process more efficient by:
11
11
12
-
-**Extended Functionality:** Additional methods to handle common data filtering scenarios.
13
-
-**Simplified API:** Streamlined usage to minimize boilerplate code and enhance readability.
14
-
-**Better Integration:** More intuitive integration with your existing .NET applications.
12
+
-**Extending Functionality:** Additional methods to handle common data filtering, ordering, and pagination scenarios.
13
+
-**Simplifying the API:** Reducing boilerplate code, making your code cleaner and easier to maintain.
14
+
-**Improving Integration:** Seamlessly integrates with .NET and EF Core projects, reducing the overhead of adding
15
+
dynamic querying to your applications.
15
16
16
17
## Features
17
-
-**Dynamic Filtering:** Easily apply dynamic filtering to your queries.
18
-
-**Dynamic Ordering:** Easily apply dynamic ordering to your queries.
19
-
-**Pagination Support:** Simplified methods for paginating your data.
20
-
-**Custom Configurations:** Extend and customize Gridify configurations effortlessly.
21
-
-**Global Injection:** Inject configurations globally for consistency across your application.
22
-
-**Support for Various Data Types:** Handle multiple data types seamlessly.
23
-
## Getting Started
24
-
To get started, install the package via NuGet:
18
+
19
+
-**Dynamic Filtering & Ordering:** Easily apply complex filters and ordering to your queries using simple methods.
20
+
-**Pagination & Cursor Support:** Paginate data efficiently with support for both traditional pagination and
21
+
cursor-based pagination for better scalability.
22
+
-**Custom Mappings:** Create custom property mappings for your entities to support advanced querying.
23
+
-**Support for Encrypted Fields:** Automatically decrypt values with the provided decryptor function.
24
+
-**Aggregation Support:** Perform common aggregate operations like sum, average, min, and max.
25
+
26
+
## Installation
27
+
28
+
Install the package via NuGet:
25
29
26
30
```bash
27
31
dotnet add package Pandatech.Gridify.Extensions
28
32
```
29
33
30
-
To enable Gridify support and register custom mapping classes, call the AddGridify method on the WebApplicationBuilder.
31
-
You can specify which assemblies to search for configurations.
34
+
## Setup
35
+
36
+
To enable Gridify support and register custom mapping classes, call the `AddGridify` method on the
37
+
`WebApplicationBuilder`.
38
+
32
39
```csharp
33
40
builder.AddGridify(paramsAssembly[] assemblies);
34
41
```
35
42
43
+
You can specify which assemblies to search for configurations. If no assemblies are provided, the current assembly will
44
+
be used.
45
+
36
46
## Usage
37
-
**Creating Mappings for Your Entities:**
38
-
To efficiently filter and query your Book entity using Gridify, you need to create a mapping class that extends FilterMapper<T>.
39
-
This class will define how each property in your Book entity should be mapped.
47
+
48
+
### Creating Mappings for Your Entities:
49
+
50
+
To efficiently filter and query your Book entity using Gridify, you need to create a mapping class that extends
51
+
`FilterMapper<T>.` This class will define how each property in your entity should be mapped for filtering.
40
52
41
53
Here’s an example of how to set up the Book entity and its corresponding mapping class:
54
+
42
55
```csharp
43
56
publicclassBook
44
57
{
@@ -56,6 +69,7 @@ public class BookMapper : FilterMapper<Book>
56
69
{
57
70
publicBookMapper()
58
71
{
72
+
GenerateMappings();
59
73
// Map "book-id" to BookId property
60
74
AddMap("book-id", x=>x.BookId);
61
75
@@ -73,68 +87,104 @@ public class BookMapper : FilterMapper<Book>
73
87
74
88
// Map "other-book-id" to the BookId property of the OtherBook property
75
89
AddMap("other-book-id", x=>x.OtherBook.BookId);
90
+
91
+
AddDefaultOrderByDescending("book-id");
76
92
}
77
93
}
78
-
79
94
```
80
95
81
-
Adding Converters
96
+
### Adding Converters
82
97
83
-
You can specify a converter function as the third parameter in the AddMap method to transform the value before it is used.
98
+
You can specify a converter function as the third parameter in the AddMap method to transform the value before it is
99
+
used.
84
100
This is useful for custom data manipulation and formatting.
85
101
86
-
**Using Extension Methods**
87
-
With Pandatech.GridifyExtensions, you can use several extension methods for filtering, sorting, and paging defined on the IQueryable<T> interface. Here are some examples:
88
-
Filtering, Sorting, and Paging
89
-
90
-
Use FilterOrderAndGetPagedAsync to apply filtering, sorting, and paging to your queries:
'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.
131
+
Use the `FilterOrderAndGetPagedAsync` method to apply filtering, sorting, and paging to your queries with selected
0 commit comments