Exemple #1
0
        protected override void NodeUpdateChange(EntityChangeNodeUpdate item)
        {
            IEnumerable <EntityChangeDescriptor> temp = ChangeLog.Where(p => p.Entity == item.Entity).ToList();

            if (!temp.Any() && item.Entity.EntityId == null)
            {
                throw new InvalidOperationException("Unable to locate entity. It must be tracked or have an EntityId.");
            }

            if (temp.Any(p => p is EntityChangeNodeDeletion))
            {
                throw new InvalidOperationException("Unable to update an entity scheduled for deletion");
            }

            if (temp.Any(p => p is EntityChangeNodeCreation))
            {
                return;
            }

            if (temp.Any(p => p.Inverse != null && p.Inverse.Equals(item)))
            {
                ChangeLog.Remove(item);
            }
            else
            {
                if (temp.Any(p => (p as EntityChangeNodeUpdate)?.Property == item.Property))
                {
                    ChangeLog.RemoveAll(p => temp.Contains(p) && (p as EntityChangeNodeUpdate)?.Property == item.Property);
                }
                ChangeLog.Add(item);
            }
        }
 protected abstract void NodeUpdateChange(EntityChangeNodeUpdate item);