Skip to content

Instance with same Id created twice. #45

@martijnburgers

Description

@martijnburgers

I have this fictional object graph with the following structure:

|- Master
    |-Details
        |-Childs

Master -> Detail 1..N
Detail -> Child 1..N

I have a query which returns a record set with 20 records containing

  • one master (duplicated over all rows)
    • which has one detail (duplicated over all rows)
      • which has 20 childs (each row containing one child).

The query is executed via Dapper and returned as a dynamic.

So when I map this I expected to get one master object which has one detail object which has 20 child objects.

|- Master (1)
    |-Details (1)
        |-Childs (20)

What I actually get is one master with two detail objects where the first detail object has one child and the second detail object has 19 childs.

|- Master (1)
    |-Details (1)
        |-Childs (1)
    |-Details (1)
        |-Childs (19)

The properties including the Id of both detail objects are the same. On the image below you see an comparison of both detail objects.

image

The first row in the record set get's it's own detail object with one child. The second till the last row get's a shared detail object but shares the master object with the first detail object.

I've looked into the data and there is nothing wrong with it. What could be going wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions