Esempio n. 1
0
        /// <summary>
        /// Compares the hierarchy.
        /// </summary>
        /// <param name="otherHierarchy">The other hierarchy.</param>
        /// <returns></returns>
        public bool CompareHierarchy(EntityObjectHierarchy otherHierarchy)
        {
            bool           retVal     = true;
            EntityComparer entityComp = CreateEntityComparer(_entityHierarchy.InnerEntity);

            if (entityComp == null || otherHierarchy.InnerEntity.MetaClassName != _entityHierarchy.InnerEntity.MetaClassName ||
                !entityComp.CompareEntity(otherHierarchy.InnerEntity))
            {
                retVal = false;
            }
            else
            {
                foreach (EntityObjectHierarchy childEntity in _entityHierarchy.Childrens)
                {
                    if (childEntity.InnerEntity.MetaClassName != _entityHierarchy.InnerEntity.MetaClassName &&
                        IsRegisteredEntity(childEntity.InnerEntity))
                    {
                        EntityHierarchyComparer entityHierarchyComp = new EntityHierarchyComparer(childEntity, _entityUsedPropMap);
                        if (otherHierarchy.Childrens.Find(entityHierarchyComp.CompareHierarchy) == null)
                        {
                            retVal = false;
                            break;
                        }
                    }
                }
            }

            return(retVal);
        }
Esempio n. 2
0
        /// <summary>
        /// Compares the hierarchy.
        /// </summary>
        /// <param name="otherHierarchy">The other hierarchy.</param>
        /// <returns></returns>
        public bool CompareHierarchy(EntityObjectHierarchy otherHierarchy)
        {
            bool retVal = true;
            EntityComparer entityComp = CreateEntityComparer(_entityHierarchy.InnerEntity);

            if (entityComp == null || otherHierarchy.InnerEntity.MetaClassName != _entityHierarchy.InnerEntity.MetaClassName ||
                !entityComp.CompareEntity(otherHierarchy.InnerEntity))
            {
                retVal = false;
            }
            else
            {
                foreach (EntityObjectHierarchy childEntity in _entityHierarchy.Childrens)
                {
                    if (childEntity.InnerEntity.MetaClassName != _entityHierarchy.InnerEntity.MetaClassName
                        && IsRegisteredEntity(childEntity.InnerEntity))
                    {
                        EntityHierarchyComparer entityHierarchyComp = new EntityHierarchyComparer(childEntity, _entityUsedPropMap);
                        if (otherHierarchy.Childrens.Find(entityHierarchyComp.CompareHierarchy) == null)
                        {
                            retVal = false;
                            break;
                        }
                    }
                }
            }

            return retVal;
        }