@@ -155,7 +155,11 @@ private object SetEntityAttributes(
155
155
continue ;
156
156
var convertedValue = ConvertAttrValue ( newValue , attr . PropertyInfo . PropertyType ) ;
157
157
attr . SetValue ( entity , convertedValue ) ;
158
- _jsonApiContext . AttributesToUpdate [ attr ] = convertedValue ;
158
+ /// todo: as a part of the process of decoupling JADNC (specifically
159
+ /// through the decoupling IJsonApiContext), we now no longer need to
160
+ /// store the updated relationship values in this property. For now
161
+ /// just assigning null as value, will remove this property later as a whole.
162
+ _jsonApiContext . AttributesToUpdate [ attr ] = null ;
159
163
}
160
164
}
161
165
@@ -249,7 +253,10 @@ private void SetHasOneForeignKeyValue(object entity, HasOneAttribute hasOneAttr,
249
253
throw new JsonApiException ( 400 , $ "Cannot set required relationship identifier '{ hasOneAttr . IdentifiablePropertyName } ' to null because it is a non-nullable type.") ;
250
254
251
255
var convertedValue = TypeHelper . ConvertType ( foreignKeyPropertyValue , foreignKeyProperty . PropertyType ) ;
252
- foreignKeyProperty . SetValue ( entity , convertedValue ) ;
256
+ /// todo: as a part of the process of decoupling JADNC (specifically
257
+ /// through the decoupling IJsonApiContext), we now no longer need to
258
+ /// store the updated relationship values in this property. For now
259
+ /// just assigning null as value, will remove this property later as a whole.
253
260
if ( convertedValue == null ) _jsonApiContext . HasOneRelationshipPointers . Add ( hasOneAttr , null ) ;
254
261
}
255
262
}
@@ -270,10 +277,11 @@ private void SetHasOneNavigationPropertyValue(object entity, HasOneAttribute has
270
277
if ( includedRelationshipObject != null )
271
278
hasOneAttr . SetValue ( entity , includedRelationshipObject ) ;
272
279
273
- // we need to store the fact that this relationship was included in the payload
274
- // for EF, the repository will use these pointers to make ensure we don't try to
275
- // create resources if they already exist, we just need to create the relationship
276
- _jsonApiContext . HasOneRelationshipPointers . Add ( hasOneAttr , includedRelationshipObject ) ;
280
+ /// todo: as a part of the process of decoupling JADNC (specifically
281
+ /// through the decoupling IJsonApiContext), we now no longer need to
282
+ /// store the updated relationship values in this property. For now
283
+ /// just assigning null as value, will remove this property later as a whole.
284
+ _jsonApiContext . HasOneRelationshipPointers . Add ( hasOneAttr , null ) ;
277
285
}
278
286
}
279
287
@@ -300,8 +308,11 @@ private object SetHasManyRelationship(object entity,
300
308
var convertedCollection = TypeHelper . ConvertCollection ( relatedResources , attr . Type ) ;
301
309
302
310
attr . SetValue ( entity , convertedCollection ) ;
303
- //_jsonApiContext.RelationshipsToUpdate[attr] = convertedCollection; // WHAT exactly is the use of these two different collections..?
304
- _jsonApiContext . HasManyRelationshipPointers . Add ( attr , convertedCollection ) ;
311
+ /// todo: as a part of the process of decoupling JADNC (specifically
312
+ /// through the decoupling IJsonApiContext), we now no longer need to
313
+ /// store the updated relationship values in this property. For now
314
+ /// just assigning null as value, will remove this property later as a whole.
315
+ _jsonApiContext . HasManyRelationshipPointers . Add ( attr , null ) ;
305
316
}
306
317
307
318
return entity ;
0 commit comments