Exemple #1
0
        public void ExecuteInDatastore()
        {
            if (Relationship is not null)
            {
                InDatastoreLogic(Relationship);
            }
            else
            {
                /*
                 *       Parent Nullable       0 to Many
                 *  (Account)-[HAS_EXTERNAL_REF]->(ExternalReference)
                 *
                 *       0 to Many      NOT NULL
                 *  (Account)-[HAS_PARENT]-(Account)
                 *
                 * Transaction:
                 *  - Delete Account
                 *  - Delete External References
                 *  - Commit
                 */

                Entity?entity = InItem?.GetEntity();
                if (entity is not null)
                {
                    foreach (var relationship in entity.Parent.Relations)
                    {
                        InDatastoreLogic(relationship);
                    }
                }
            }
        }
Exemple #2
0
        public void ExecuteInMemory(Core.EntityCollectionBase target)
        {
            if (!target.IsLoaded)
            {
                return;
            }

            if (Relationship != null)
            {
                if (Relationship.Name != target.Relationship.Name)
                {
                    return;
                }

                if (ActsOnSpecificParent())
                {
                    if (target.Parent != target.ParentItem(this))
                    {
                        return;
                    }
                }
            }
            else
            {
                Entity entity    = InItem.GetEntity();
                bool   shouldRun = false;
                if (target.ParentEntity == entity)
                {
                    shouldRun = true;
                    if (target.ForeignProperty != null && !target.ForeignProperty.Nullable)
                    {
                        return;
                    }
                }
                if (target.ForeignEntity == entity)
                {
                    shouldRun = true;
                    if (target.ParentProperty != null && !target.ParentProperty.Nullable)
                    {
                        return;
                    }
                }
                if (!shouldRun)
                {
                    return;
                }
            }
            InMemoryLogic(target);
        }
Exemple #3
0
        public void ExecuteInDatastore()
        {
            if (Relationship != null)
            {
                InDatastoreLogic(Relationship);
            }
            else
            {
                Entity entity = InItem.GetEntity();
                foreach (var relationship in entity.Parent.Relations)
                {
                    bool shouldRun = false;
                    if (entity.IsSelfOrSubclassOf(relationship.InEntity))
                    {
                        shouldRun = true;
                        if (relationship.OutProperty != null && !relationship.OutProperty.Nullable)
                        {
                            continue;
                        }
                    }
                    if (entity.IsSelfOrSubclassOf(relationship.OutEntity))
                    {
                        shouldRun = true;
                        if (relationship.InProperty != null && !relationship.InProperty.Nullable)
                        {
                            continue;
                        }
                    }
                    if (!shouldRun)
                    {
                        continue;
                    }

                    InDatastoreLogic(relationship);
                }
            }
        }