Detached-Mapper icon indicating copy to clipboard operation
Detached-Mapper copied to clipboard

Explicit indication of an action with a child entity

Open dmalapsh opened this issue 3 months ago • 2 comments

Hi, thank you for your hard work and this wonderful library.

I want to use Detached-Mapper in combination with hotchocolate to create/update entities.

The peculiarity of my case is that some of my entities have quite a large number of child elements. Due to this fact, I cannot transfer the full list of items for synchronization. Is there a way to "explicitly" specify what needs to be done with the child element?

Here is an example of the input data:

{
  "parent": {
    "id": 1,
    "children": {
      "attach": [2, 3],
      "detach": [5],
      "update": [
        {
          "id": 6,
          "value": "value1"
        }
      ],
      "create": [
        {
          "value": "value2"
        }
      ],
      "delete": [1]
    }
  }
}

This example uses a "many to many" relationship.

Perhaps I was I was inattentive and similar functionality already exists?

dmalapsh avatar Sep 19 '25 22:09 dmalapsh