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

Should be able to add a dependent entity with identifying FK before the principal #1207

Closed
AndriySvyryd opened this issue Dec 3, 2014 · 1 comment
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@AndriySvyryd
Copy link
Member

If a dependent entity with identifying FK is added before the principal it is referencing then the state manager should add the principal to allow its PK to be generated.

Related to #323

@rowanmiller
Copy link
Contributor

We have a work item to track general exploratory testing in this area (#1164). In general we think it would be best to avoid complex rules/behaviors/etc. but once we have the graph behaviors implemented we should explore these areas and see if there are real scenarios where the behavior is just broken.

ajcvickers added a commit that referenced this issue Dec 16, 2014
…ny Order

See issues #1271 and #1207. The main issue here is that if a dependent entity is added to the context before its principal has been added then the primary key value of the principal has not yet been generated. This means that people need to be careful which order to add things in, which in turn means that AttachGraph would not work in some scenarios,

The fix is to find the value generator for the principal of the relationship (possibly traversing several relationships to do so) and use it to generate a temporary key for the dependent entity. When the principal is finally added fixup will happen and the actual principal value will be propagated down to the dependents. The value generator for the ultimate principal needs to be used (instead of some other generator) so that key conflicts in the generated values do not happen as values propagate down.
@ajcvickers ajcvickers reopened this Dec 16, 2014
@ajcvickers ajcvickers self-assigned this Dec 16, 2014
@ajcvickers ajcvickers added this to the 7.0.0 milestone Dec 16, 2014
ajcvickers added a commit that referenced this issue Dec 18, 2014
…ny Order

See issues #1271 and #1207. The main issue here is that if a dependent entity is added to the context before its principal has been added then the primary key value of the principal has not yet been generated. This means that people need to be careful which order to add things in, which in turn means that AttachGraph would not work in some scenarios,

The fix is to find the value generator for the principal of the relationship (possibly traversing several relationships to do so) and use it to generate a temporary key for the dependent entity. When the principal is finally added fixup will happen and the actual principal value will be propagated down to the dependents. The value generator for the ultimate principal needs to be used (instead of some other generator) so that key conflicts in the generated values do not happen as values propagate down.
ajcvickers added a commit that referenced this issue Dec 18, 2014
…ny Order

See issues #1271 and #1207. The main issue here is that if a dependent entity is added to the context before its principal has been added then the primary key value of the principal has not yet been generated. This means that people need to be careful which order to add things in, which in turn means that AttachGraph would not work in some scenarios,

The fix is to find the value generator for the principal of the relationship (possibly traversing several relationships to do so) and use it to generate a temporary key for the dependent entity. When the principal is finally added fixup will happen and the actual principal value will be propagated down to the dependents. The value generator for the ultimate principal needs to be used (instead of some other generator) so that key conflicts in the generated values do not happen as values propagate down.
@ajcvickers ajcvickers modified the milestones: 7.0.0-rc1, 7.0.0 Dec 18, 2014
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers modified the milestones: 1.0.0-beta3, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

3 participants