예제 #1
0
        internal void NotifyStateChange(EntityAspect entityAspect, bool needsSave)
        {
            entityAspect.OnEntityChanged(EntityAction.EntityStateChange);

            if (needsSave)
            {
                SetHasChanges(true);
            }
            else
            {
                // called when rejecting a change or merging an unchanged record.
                // NOTE: this can be slow with lots of entities in the cache.
                if (this._hasChanges)
                {
                    if (this.IsLoadingEntity)
                    {
                        this.HasChangesAction = this.HasChangesAction ?? (() => SetHasChanges(null));
                    }
                    else
                    {
                        SetHasChanges(null);
                    }
                }
            }
        }