-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
AttachAndReloadAssociatedEntity #136
Labels
Comments
ghost
added
the
potential bug
label
Jul 22, 2015
what is the workaround? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this method has some issues. There are two paths:
Path A: The entity exists in memory in the context
Path B: The entity is not in memory in the context
In Path B, steps 1/2/3 accomplish the same thing as Path A-1.
Path A-4 performs an extra step that I think is mistaken, at least if proxies are turned on. The previous Reload() call is going to populate all the navigation properties, so there's no need to do more work. Additionally, if Path A is hit we also get a non-hydrated object if proxies are off. I think this is the cause of #117
Additionally, the AttachRequiredNavigationProperties() method, rather than loading the navigation properties from the database, is copying them from the updated object - which, being an AssociatedEntity may not be fully hydrated or may contain changes that we should ignore - which this method won't do.
I believe this method needs to take into account proxies, and can have two paths:
Proxies on - create from id and reload. (Path B 1 to 3)
Proxies off - inject IQueryLoader and perform LoadEntity on each newly-added AssociatedEntity.
If this makes sense, I'll create a pull request for the changes.
The text was updated successfully, but these errors were encountered: