Open Closed

The instance of entity type ... cannot be tracked because... #5086


0
easy2u created

We have the same same issue as in

<a class="postlink" href="https://stackoverflow.com/questions/49798566/the-instance-of-entity-type-product-cannot-be-tracked-because-another-instance">https://stackoverflow.com/questions/497 ... r-instance</a>

but are unsure under what conditions it may happen. It happened to us from unit test in which we created entity through one service call and tried to updated it in the same unit test by invoking update service method (passing it modified DTO from first call) that had very similar code as in the stack overflow question and resolution to the problem as in the answer.

What we would like to understand is when/why it is happening? Is there anything in the documentation how to prevent this from happening or why it may happen? We understand how it works with EF Core (and how to solve it), but are unsure how Abp/ASP.NET Zero wrappers (repositories) are interacting/causing this with EF and when/how we need to prevent this from happening.


1 Answer(s)
  • 0
    aaron created
    Support Team

    Show all relevant code.