Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance with same Id created twice. #45

Open
martijnburgers opened this issue Oct 17, 2016 · 0 comments
Open

Instance with same Id created twice. #45

martijnburgers opened this issue Oct 17, 2016 · 0 comments

Comments

@martijnburgers
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant