File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ JsonApiDotnetCore provides a framework for building [json:api](http://jsonapi.or
24
24
- [Pagination](#pagination)
25
25
- [Filtering](#filtering)
26
26
- [Sorting](#sorting)
27
+ - [Meta](#meta)
27
28
- [ Tests] ( #tests )
28
29
29
30
## Installation
@@ -240,6 +241,18 @@ when setting up the services:
240
241
opt => opt .DefaultPageSize = 10 );
241
242
```
242
243
244
+ ** Total Record Count**
245
+
246
+ The total number of records can be added to the document meta by setting it in the options:
247
+
248
+ ```
249
+ services.AddJsonApi<AppDbContext>(opt =>
250
+ {
251
+ opt.DefaultPageSize = 5;
252
+ opt.IncludeTotalRecordCount = true;
253
+ });
254
+ ```
255
+
243
256
### Filtering
244
257
245
258
You can filter resources by attributes using the ` filter ` query parameter.
@@ -270,6 +283,25 @@ Resources can be sorted by an attribute:
270
283
?sort=-attribute // descending
271
284
```
272
285
286
+ ### Meta
287
+
288
+ Resource meta can be defined by implementing ` IHasMeta ` on the model class:
289
+
290
+ ```
291
+ public class Person : Identifiable<int>, IHasMeta
292
+ {
293
+ // ...
294
+
295
+ public Dictionary<string, object> GetMeta(IJsonApiContext context)
296
+ {
297
+ return new Dictionary<string, object> {
298
+ { "copyright", "Copyright 2015 Example Corp." },
299
+ { "authors", new string[] { "Jared Nance" } }
300
+ };
301
+ }
302
+ }
303
+ ```
304
+
273
305
## Tests
274
306
275
307
I am using DotNetCoreDocs to generate sample requests and documentation.
You can’t perform that action at this time.
0 commit comments