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

INSERT error (The property 'ID' on entity type 'xxx' has a temporary value) #21555

Closed
juliusfriedman opened this issue Jul 8, 2020 · 5 comments

Comments

@juliusfriedman
Copy link

juliusfriedman commented Jul 8, 2020

See #9552

Same issue still in 3.1.5

If I remove the Entity property it Attach's without issue and I can even use Update

Solution

Automatically null the references which are in the entity during the building of the graph in SaveChanges, it's annoying and pointless to get this because you can just erase or ignore the references yourself.

@smitpatel
Copy link
Contributor

This issue is lacking enough information for us to effectively reproduce. Please post a runnable project/solution or complete code listing that demonstrates the behavior you are seeing.

@juliusfriedman
Copy link
Author

juliusfriedman commented Jul 8, 2020

The same code which can be used in the previous example SHOULD throw it.

I have a entry which has multiple entities which can be attached e.g. many to one.

When I don't attach them I get the exception.

I propose you just null these if they are in the graph and consider them unchanged unless someone adds them / updates or deletes them. (after all the ID will be default and you can easily tell)

Why does this throw anyway... should this not just say oh okay I already tracked it, is there a change I don't have if so I will take that otherwise move along.

@ajcvickers
Copy link
Contributor

As @smitpatel said, please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

@juliusfriedman
Copy link
Author

The problem is in my current project not the one I will produce (but hopefully I can)

The point still stands. Why do we throw at all in these sitations.

@ajcvickers
Copy link
Contributor

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants