File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/JsonApiDotNetCore/Builders Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -68,21 +68,20 @@ public Documents Build(IEnumerable<IIdentifiable> entities)
6868
6969 private Dictionary < string , object > GetMeta ( IIdentifiable entity )
7070 {
71- if ( entity == null ) return null ;
72-
7371 var builder = _jsonApiContext . MetaBuilder ;
74-
75- if ( entity is IHasMeta metaEntity )
76- builder . Add ( metaEntity . GetMeta ( _jsonApiContext ) ) ;
77-
7872 if ( _jsonApiContext . Options . IncludeTotalRecordCount && _jsonApiContext . PageManager . TotalRecords != null )
7973 builder . Add ( "total-records" , _jsonApiContext . PageManager . TotalRecords ) ;
8074
8175 if ( _requestMeta != null )
8276 builder . Add ( _requestMeta . GetMeta ( ) ) ;
8377
78+ if ( entity != null && entity is IHasMeta metaEntity )
79+ builder . Add ( metaEntity . GetMeta ( _jsonApiContext ) ) ;
80+
8481 var meta = builder . Build ( ) ;
85- if ( meta . Count > 0 ) return meta ;
82+ if ( meta . Count > 0 )
83+ return meta ;
84+
8685 return null ;
8786 }
8887
You can’t perform that action at this time.
0 commit comments