File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/JsonApiDotNetCore/Builders Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -62,16 +62,16 @@ public Documents Build(IEnumerable<IIdentifiable> entities)
62
62
private Dictionary < string , object > _getMeta ( IIdentifiable entity )
63
63
{
64
64
if ( entity == null ) return null ;
65
-
66
- var meta = new Dictionary < string , object > ( ) ;
67
- var metaEntity = entity as IHasMeta ;
68
65
69
- if ( metaEntity != null )
70
- meta = metaEntity . GetMeta ( _jsonApiContext ) ;
66
+ var builder = _jsonApiContext . MetaBuilder ;
67
+
68
+ if ( entity is IHasMeta metaEntity )
69
+ builder . Add ( metaEntity . GetMeta ( _jsonApiContext ) ) ;
71
70
72
71
if ( _jsonApiContext . Options . IncludeTotalRecordCount )
73
- meta [ "total-records" ] = _jsonApiContext . PageManager . TotalRecords ;
72
+ builder . Add ( "total-records" , _jsonApiContext . PageManager . TotalRecords ) ;
74
73
74
+ var meta = builder . Build ( ) ;
75
75
if ( meta . Count > 0 ) return meta ;
76
76
return null ;
77
77
}
You can’t perform that action at this time.
0 commit comments