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

Add change tracking support for shadow navigations to non-shadow entity types #9918

Merged
merged 1 commit into from
Sep 29, 2017

Conversation

AndriySvyryd
Copy link
Member

More tests will be added

Part of #749

/// directly from your code. This API may change or be removed in future releases.
/// </summary>
public class ShadowCollectionAccessor<TCollection, TElement> : IShadowCollectionAccessor
where TCollection : class, IEnumerable<TElement>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be generic? For the collection snapshot, we just use object.

Copy link
Member Author

Choose a reason for hiding this comment

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

This class is mostly superfluous, I'll just inline it.

@ajcvickers
Copy link
Contributor

I think it would be good to discuss when we are in the office. I'd like to understand the need to move things to the state entry.

@AndriySvyryd
Copy link
Member Author

The methods are moved to InternalStateEntry to abstract away the shadowness in the same way it's done for the properties, without adding any dependencies to the accessor implementation.

@AndriySvyryd AndriySvyryd changed the title WIP: Add change tracking support for shadow navigations to non-shadow entity types Add change tracking support for shadow navigations to non-shadow entity types Sep 29, 2017
public virtual IEnumerable GetOrCreateCollection([NotNull] INavigation navigation)
{
return navigation.GetCollectionAccessor().GetOrCreate(Entity);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Expression body?

Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to add Debug.Assert(!navigation.IsShadowProperty);

@@ -12,7 +13,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
public class ClrICollectionAccessor<TEntity, TCollection, TElement> : IClrCollectionAccessor
public class ClrCollectionAccessor<TEntity, TCollection, TElement> : IClrCollectionAccessor
Copy link
Contributor

Choose a reason for hiding this comment

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

ClrCollectionAccessor [](start = 17, length = 21)

The "I" is there for a reason. It means this is the implementation for ICollection, rather than just the gneral concept of some kind of collection of things on a thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Still, it goes against our naming guidelines

@@ -41,19 +42,19 @@ public interface IClrCollectionAccessor
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
object Create();
IEnumerable Create();
Copy link
Contributor

Choose a reason for hiding this comment

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

IEnumerable [](start = 8, length = 11)

Do we need to constrain this to only collections that implement IEnumerable?

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

3 participants