@@ -164,27 +164,34 @@ services.AddJsonApi<AppDbContext>(
164
164
opt => opt .Namespace = " api/v1" );
165
165
```
166
166
167
- ## Pagination
168
-
169
- If you would like pagination implemented by default, you can specify the page size
170
- when setting up the services:
171
-
172
- ``` csharp
173
- services .AddJsonApi <AppDbContext >(
174
- opt => opt .DefaultPageSize = 10 );
175
- ```
176
-
177
167
## Defining Custom Data Access Methods
178
168
179
169
You can implement custom methods for accessing the data by creating an implementation of
180
170
` IEntityRepository<TEntity, TId> ` . If you only need minor changes you can override the
181
171
methods defined in ` DefaultEntityRepository<TEntity, TId> ` . The repository should then be
182
172
add to the service collection in ` Startup.ConfigureServices ` like so:
183
173
184
- ```
174
+ ``` csharp
185
175
services .AddScoped <IEntityRepository <MyEntity ,Guid >, MyEntityRepository >();
186
176
```
187
177
178
+ ## Pagination
179
+
180
+ Resources can be paginated.
181
+ The following query would set the page size to 10 and get page 2.
182
+
183
+ ```
184
+ ?page[size]=10&page[number]=2
185
+ ```
186
+
187
+ If you would like pagination implemented by default, you can specify the page size
188
+ when setting up the services:
189
+
190
+ ``` csharp
191
+ services .AddJsonApi <AppDbContext >(
192
+ opt => opt .DefaultPageSize = 10 );
193
+ ```
194
+
188
195
## Filtering
189
196
190
197
You can filter resources by attributes using the ` filter ` query parameter.
@@ -206,7 +213,6 @@ identifier):
206
213
?filter[attribute]=ge:value
207
214
```
208
215
209
-
210
216
## Sorting
211
217
212
218
Resources can be sorted by an attribute:
0 commit comments