@@ -124,7 +124,7 @@ public object DocumentToObject(DocumentData data, List<DocumentData> included =
124
124
+ "If you have manually registered the resource, check that the call to AddResource correctly sets the public name." ) ; ;
125
125
126
126
var entity = Activator . CreateInstance ( contextEntity . EntityType ) ;
127
-
127
+
128
128
entity = SetEntityAttributes ( entity , contextEntity , data . Attributes ) ;
129
129
entity = SetRelationships ( entity , contextEntity , data . Relationships , included ) ;
130
130
@@ -141,7 +141,7 @@ private object SetEntityAttributes(
141
141
{
142
142
if ( attributeValues == null || attributeValues . Count == 0 )
143
143
return entity ;
144
-
144
+
145
145
foreach ( var attr in contextEntity . Attributes )
146
146
{
147
147
if ( attributeValues . TryGetValue ( attr . PublicAttributeName , out object newValue ) )
@@ -174,7 +174,7 @@ private object DeserializeComplexType(JContainer obj, Type targetType)
174
174
private object SetRelationships (
175
175
object entity ,
176
176
ContextEntity contextEntity ,
177
- Dictionary < string , RelationshipData > relationships ,
177
+ Dictionary < string , RelationshipData > relationships ,
178
178
List < DocumentData > included = null )
179
179
{
180
180
if ( relationships == null || relationships . Count == 0 )
@@ -203,7 +203,7 @@ private object SetHasOneRelationship(object entity,
203
203
204
204
if ( relationships . TryGetValue ( relationshipName , out RelationshipData relationshipData ) == false )
205
205
return entity ;
206
-
206
+
207
207
var relationshipAttr = _jsonApiContext . RequestEntity . Relationships
208
208
. SingleOrDefault ( r => r . PublicRelationshipName == relationshipName ) ;
209
209
@@ -234,7 +234,7 @@ private object SetHasOneRelationship(object entity,
234
234
foreignKeyProperty . SetValue ( entity , convertedValue ) ;
235
235
236
236
237
- if ( rio != null
237
+ if ( rio != null
238
238
// if the resource identifier is null, there should be no reason to instantiate an instance
239
239
&& rio . Id != null )
240
240
{
@@ -247,7 +247,7 @@ private object SetHasOneRelationship(object entity,
247
247
// we need to store the fact that this relationship was included in the payload
248
248
// for EF, the repository will use these pointers to make ensure we don't try to
249
249
// create resources if they already exist, we just need to create the relationship
250
- _jsonApiContext . HasOneRelationshipPointers . Add ( attr . Type , includedRelationshipObject ) ;
250
+ _jsonApiContext . HasOneRelationshipPointers . Add ( attr , includedRelationshipObject ) ;
251
251
}
252
252
253
253
return entity ;
@@ -278,7 +278,7 @@ private object SetHasManyRelationship(object entity,
278
278
279
279
attr . SetValue ( entity , convertedCollection ) ;
280
280
281
- _jsonApiContext . HasManyRelationshipPointers . Add ( attr . Type , convertedCollection ) ;
281
+ _jsonApiContext . HasManyRelationshipPointers . Add ( attr , convertedCollection ) ;
282
282
}
283
283
284
284
return entity ;
@@ -301,7 +301,7 @@ private IIdentifiable GetIncludedRelationship(ResourceIdentifierObject relatedRe
301
301
var contextEntity = _jsonApiContext . ContextGraph . GetContextEntity ( relationshipAttr . Type ) ;
302
302
if ( contextEntity == null )
303
303
throw new JsonApiException ( 400 , $ "Included type '{ relationshipAttr . Type } ' is not a registered json:api resource.") ;
304
-
304
+
305
305
SetEntityAttributes ( relatedInstance , contextEntity , includedResource . Attributes ) ;
306
306
307
307
return relatedInstance ;
0 commit comments