Partial updates of entities with collections #82
Closed
MichaelM223
started this conversation in
Ideas
Replies: 2 comments 4 replies
-
Makes sense, but I would do it configurable just in case it breaks scenarios for other few people who is using it |
Beta Was this translation helpful? Give feedback.
3 replies
-
I manually added the feature and it's called MapParameters.CompositeCollectionBehavior |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was struggling with updating some entities with collections that have their collection set to
null
when relationships have not been resolved yet. EF Core skipsnull
collections for when checking for relationship modifications.EntityCollectionTypeMapper
andMergeEntityCollectionTypeMapper' however map
null` values to an empty collection.With non-collection members I can agree you can't differ from removal or not set when a
null
value is passed. With collections though I think a empty collection indicates deletion of all relationships andnull
is clearly 'not-set' in my opinion.The changes below work perfectly in my case but maybe I'm forgetting something?
Would it be ok if I submitted a pull request for two small changes in
EntityCollectionTypeMapper
and `MergeEntityCollectionTypeMapper'?After line 31 I would add:
Detached-Mapper/src/Detached.Mappers/TypeMappers/Entity/Collection/EntityCollectionTypeMapper.cs
Lines 30 to 33 in 66bd475
Detached-Mapper/src/Detached.Mappers/TypeMappers/Entity/Collection/MergeEntityCollectionTypeMapper.cs
Lines 30 to 33 in 66bd475
Beta Was this translation helpful? Give feedback.
All reactions