@@ -155,7 +155,11 @@ private object SetEntityAttributes(
155155 continue ;
156156 var convertedValue = ConvertAttrValue ( newValue , attr . PropertyInfo . PropertyType ) ;
157157 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 ;
159163 }
160164 }
161165
@@ -249,7 +253,10 @@ private void SetHasOneForeignKeyValue(object entity, HasOneAttribute hasOneAttr,
249253 throw new JsonApiException ( 400 , $ "Cannot set required relationship identifier '{ hasOneAttr . IdentifiablePropertyName } ' to null because it is a non-nullable type.") ;
250254
251255 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.
253260 if ( convertedValue == null ) _jsonApiContext . HasOneRelationshipPointers . Add ( hasOneAttr , null ) ;
254261 }
255262 }
@@ -270,10 +277,11 @@ private void SetHasOneNavigationPropertyValue(object entity, HasOneAttribute has
270277 if ( includedRelationshipObject != null )
271278 hasOneAttr . SetValue ( entity , includedRelationshipObject ) ;
272279
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 ) ;
277285 }
278286 }
279287
@@ -300,8 +308,11 @@ private object SetHasManyRelationship(object entity,
300308 var convertedCollection = TypeHelper . ConvertCollection ( relatedResources , attr . Type ) ;
301309
302310 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 ) ;
305316 }
306317
307318 return entity ;
0 commit comments