@@ -58,7 +58,7 @@ public Documents Build(IEnumerable<IIdentifiable> entities)
58
58
var enumeratedEntities = entities as IList < IIdentifiable > ?? entities . ToList ( ) ;
59
59
var documents = new Documents
60
60
{
61
- Data = new List < DocumentData > ( ) ,
61
+ Data = new List < ResourceObject > ( ) ,
62
62
Meta = GetMeta ( enumeratedEntities . FirstOrDefault ( ) )
63
63
} ;
64
64
@@ -95,7 +95,7 @@ private Dictionary<string, object> GetMeta(IIdentifiable entity)
95
95
96
96
private bool ShouldIncludePageLinks ( ContextEntity entity ) => entity . Links . HasFlag ( Link . Paging ) ;
97
97
98
- private List < DocumentData > AppendIncludedObject ( List < DocumentData > includedObject , ContextEntity contextEntity , IIdentifiable entity )
98
+ private List < ResourceObject > AppendIncludedObject ( List < ResourceObject > includedObject , ContextEntity contextEntity , IIdentifiable entity )
99
99
{
100
100
var includedEntities = GetIncludedEntities ( includedObject , contextEntity , entity ) ;
101
101
if ( includedEntities ? . Count > 0 )
@@ -107,13 +107,12 @@ private List<DocumentData> AppendIncludedObject(List<DocumentData> includedObjec
107
107
}
108
108
109
109
[ Obsolete ( "You should specify an IResourceDefinition implementation using the GetData/3 overload." ) ]
110
- public DocumentData GetData ( ContextEntity contextEntity , IIdentifiable entity )
110
+ public ResourceObject GetData ( ContextEntity contextEntity , IIdentifiable entity )
111
111
=> GetData ( contextEntity , entity , resourceDefinition : null ) ;
112
112
113
- public DocumentData GetData ( ContextEntity contextEntity , IIdentifiable entity , IResourceDefinition resourceDefinition = null )
113
+ public ResourceObject GetData ( ContextEntity contextEntity , IIdentifiable entity , IResourceDefinition resourceDefinition = null )
114
114
{
115
- var data = new DocumentData
116
- {
115
+ var data = new ResourceObject {
117
116
Type = contextEntity . EntityName ,
118
117
Id = entity . StringId
119
118
} ;
@@ -151,7 +150,7 @@ private bool OmitNullValuedAttribute(AttrAttribute attr, object attributeValue)
151
150
return attributeValue == null && _documentBuilderOptions . OmitNullValuedAttributes ;
152
151
}
153
152
154
- private void AddRelationships ( DocumentData data , ContextEntity contextEntity , IIdentifiable entity )
153
+ private void AddRelationships ( ResourceObject data , ContextEntity contextEntity , IIdentifiable entity )
155
154
{
156
155
data . Relationships = new Dictionary < string , RelationshipData > ( ) ;
157
156
contextEntity . Relationships . ForEach ( r =>
@@ -192,9 +191,9 @@ private RelationshipData GetRelationshipData(RelationshipAttribute attr, Context
192
191
return relationshipData ;
193
192
}
194
193
195
- private List < DocumentData > GetIncludedEntities ( List < DocumentData > included , ContextEntity rootContextEntity , IIdentifiable rootResource )
194
+ private List < ResourceObject > GetIncludedEntities ( List < ResourceObject > included , ContextEntity rootContextEntity , IIdentifiable rootResource )
196
195
{
197
- if ( _jsonApiContext . IncludedRelationships != null )
196
+ if ( _jsonApiContext . IncludedRelationships != null )
198
197
{
199
198
foreach ( var relationshipName in _jsonApiContext . IncludedRelationships )
200
199
{
@@ -209,8 +208,8 @@ private List<DocumentData> GetIncludedEntities(List<DocumentData> included, Cont
209
208
return included ;
210
209
}
211
210
212
- private List < DocumentData > IncludeRelationshipChain (
213
- List < DocumentData > included , ContextEntity parentEntity , IIdentifiable parentResource , string [ ] relationshipChain , int relationshipChainIndex )
211
+ private List < ResourceObject > IncludeRelationshipChain (
212
+ List < ResourceObject > included , ContextEntity parentEntity , IIdentifiable parentResource , string [ ] relationshipChain , int relationshipChainIndex )
214
213
{
215
214
var requestedRelationship = relationshipChain [ relationshipChainIndex ] ;
216
215
var relationship = parentEntity . Relationships . FirstOrDefault ( r => r . PublicRelationshipName == requestedRelationship ) ;
@@ -232,10 +231,10 @@ private List<DocumentData> IncludeRelationshipChain(
232
231
return included ;
233
232
}
234
233
235
- private List < DocumentData > IncludeSingleResourceRelationships (
236
- List < DocumentData > included , IIdentifiable navigationEntity , RelationshipAttribute relationship , string [ ] relationshipChain , int relationshipChainIndex )
234
+ private List < ResourceObject > IncludeSingleResourceRelationships (
235
+ List < ResourceObject > included , IIdentifiable navigationEntity , RelationshipAttribute relationship , string [ ] relationshipChain , int relationshipChainIndex )
237
236
{
238
- if ( relationshipChainIndex < relationshipChain . Length )
237
+ if ( relationshipChainIndex < relationshipChain . Length )
239
238
{
240
239
var nextContextEntity = _jsonApiContext . ContextGraph . GetContextEntity ( relationship . Type ) ;
241
240
var resource = ( IIdentifiable ) navigationEntity ;
@@ -248,12 +247,12 @@ private List<DocumentData> IncludeSingleResourceRelationships(
248
247
}
249
248
250
249
251
- private List < DocumentData > AddIncludedEntity ( List < DocumentData > entities , IIdentifiable entity )
250
+ private List < ResourceObject > AddIncludedEntity ( List < ResourceObject > entities , IIdentifiable entity )
252
251
{
253
252
var includedEntity = GetIncludedEntity ( entity ) ;
254
253
255
254
if ( entities == null )
256
- entities = new List < DocumentData > ( ) ;
255
+ entities = new List < ResourceObject > ( ) ;
257
256
258
257
if ( includedEntity != null && entities . Any ( doc =>
259
258
string . Equals ( doc . Id , includedEntity . Id ) && string . Equals ( doc . Type , includedEntity . Type ) ) == false )
@@ -264,7 +263,7 @@ private List<DocumentData> AddIncludedEntity(List<DocumentData> entities, IIdent
264
263
return entities ;
265
264
}
266
265
267
- private DocumentData GetIncludedEntity ( IIdentifiable entity )
266
+ private ResourceObject GetIncludedEntity ( IIdentifiable entity )
268
267
{
269
268
if ( entity == null ) return null ;
270
269
0 commit comments