File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 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
2424 - [Pagination](#pagination)
2525 - [Filtering](#filtering)
2626 - [Sorting](#sorting)
27+ - [Meta](#meta)
2728- [ Tests] ( #tests )
2829
2930## Installation
@@ -240,6 +241,18 @@ when setting up the services:
240241 opt => opt .DefaultPageSize = 10 );
241242```
242243
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+
243256### Filtering
244257
245258You can filter resources by attributes using the ` filter ` query parameter.
@@ -270,6 +283,25 @@ Resources can be sorted by an attribute:
270283?sort=-attribute // descending
271284```
272285
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+
273305## Tests
274306
275307I am using DotNetCoreDocs to generate sample requests and documentation.
You can’t perform that action at this time.
0 commit comments