Skip to content

Make owned entities take their state from owner when attaching - #8986

Merged
ajcvickers merged 1 commit into
devfrom
SweetDreamsAreMadeOfThis0627
Jul 5, 2017
Merged

ajcvickers merged 1 commit into
devfrom
SweetDreamsAreMadeOfThis0627

Conversation

@ajcvickers

@ajcvickers ajcvickers commented Jun 27, 2017 •

Copy link
Copy Markdown
Contributor

Issue #7985

Moved key propagation inside state manager for keys that are unknown--typically shadow keys on attached entities. This prevents common cases of key not set for identifying relationships. Also added special behavior used by Attach that will take the entity state from the principal. If graph attach comes from DetectChanges, then state is still Added--because it wasn't there and now it is.

// ReSharper disable once CheckForReferenceEqualityInstead.2
if (Equals(keyValue.Key.ClrType, type)
&& keyValue.Value.TryGetValue(entity, out entry))
&& keyValue.Value.TryGetValue(entity, out InternalEntityEntry foundEntry))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use out var

@ajcvickers
ajcvickers force-pushed the SweetDreamsAreMadeOfThis0627 branch from e7a0b38 to 5c39893 Compare July 1, 2017 02:12
@ajcvickers

Copy link
Copy Markdown
Contributor Author

@AndriySvyryd @anpete Updated this based on triage discussion/decisions.

…ching

Issue #7985

Moved key propagation inside state manager for keys that are unknown--typically shadow keys on attached entities. This prevents common cases of key not set for identifying relationships. Also added special behavior used by Attach that will take the entity state from the principal. If graph attach comes from DetectChanges, then state is still Added--because it wasn't there and now it is.
@ajcvickers
ajcvickers force-pushed the SweetDreamsAreMadeOfThis0627 branch from 5c39893 to 64a499b Compare July 5, 2017 21:32
@ajcvickers
ajcvickers merged commit 64a499b into dev Jul 5, 2017
@smitpatel
smitpatel deleted the SweetDreamsAreMadeOfThis0627 branch July 5, 2017 23:49
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

Successfully merging this pull request may close these issues.

4 participants