src/Shared/EntityFramework/Core/Objects/DataClasses/EntityObject.cs
/// <summary>
/// Used by the ObjectStateManager to attach or detach this EntityObject to the cache.
/// </summary>
/// <param name="changeTracker"> Reference to the ObjectStateEntry that contains this entity </param>
Used by the ObjectStateManager to attach or detach this EntityObject to the cache.
Used by the ObjectStateManager to attach or detach this EntityObject to the cache .
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        void IEntityWithChangeTracker.SetChangeTracker(IEntityChangeTracker changeTracker)
        {
            if (changeTracker != null
                && EntityChangeTracker != _detachedEntityChangeTracker
                && !ReferenceEquals(changeTracker, EntityChangeTracker))
            {
                var entry = EntityChangeTracker as EntityEntry;
                if (entry == null
                    || !entry.ObjectStateManager.IsDisposed)
                {
                    throw new InvalidOperationException(Strings.Entity_EntityCantHaveMultipleChangeTrackers);
                }
            }
            EntityChangeTracker = changeTracker;
        }
[ SuppressMessage ( " " , " " ) ] void IEntityWithChangeTracker . SetChangeTracker ( IEntityChangeTracker changeTracker ) { if ( changeTracker != null && EntityChangeTracker != _detachedEntityChangeTracker && ! ReferenceEquals ( changeTracker , EntityChangeTracker ) ) { var entry = EntityChangeTracker as EntityEntry ; if ( entry == null || ! entry . ObjectStateManager . IsDisposed ) { throw new InvalidOperationException ( Strings . Entity_EntityCantHaveMultipleChangeTrackers ) ; } } EntityChangeTracker = changeTracker ; }
Used by the ObjectStateManager to attach or detach this EntityObject to the cache.
Used by the ObjectStateManager to attach or detach this EntityObject to the cache .
// Fail if the change tracker is already set for this EntityObject and it's being set to something different // If the original change tracker is associated with a disposed ObjectStateManager, then allow // the entity to be attached
changeTracker
IEntityChangeTracker
Reference to the ObjectStateEntry that contains this entity
Reference to the ObjectStateEntry that contains this entity