Esempio n. 1
0
        private void AddChildEntity(IEntity entity, bool readOnly, bool child)
        {
            if (Configuration.Instance.ExcludeRegexIsMatch(entity.EntityKeyName))
            {
                return;
            }

            if (readOnly)
            {
                if (ReadOnlyChildEntities.Count > 0 && ReadOnlyChildEntities.Contains(entity))
                {
                    return;
                }
                if (ReadOnlyRootEntities.Count > 0 && ReadOnlyRootEntities.Contains(entity))
                {
                    return;
                }

                if (child)
                {
                    ReadOnlyChildEntities.Add(entity);
                }
                else
                {
                    ReadOnlyRootEntities.Add(entity);
                }
            }
            else
            {
                if (DynamicRootEntities.Count > 0 && DynamicRootEntities.Contains(entity))
                {
                    return;
                }
                if (EditableChildEntities.Count > 0 && EditableChildEntities.Contains(entity))
                {
                    return;
                }
                if (EditableRootEntities.Count > 0 && EditableRootEntities.Contains(entity))
                {
                    return;
                }
                if (SwitchableObjectEntities.Count > 0 && SwitchableObjectEntities.Contains(entity))
                {
                    return;
                }

                if (child)
                {
                    EditableChildEntities.Add(entity);
                }
                else
                {
                    EditableRootEntities.Add(entity);
                }
            }
        }
Esempio n. 2
0
        public void PopulateDefaultEntities(List <IEntity> entities)
        {
            //EditableRoot
            foreach (var entity in GetRootEntities(entities))
            {
                if (!EditableRootEntities.Contains(entity))
                {
                    EditableRootEntities.Add(entity);
                }
            }

            //EditableChild
            foreach (var entity in GetChildEntities(entities).Values.Where(e => e is TableEntity || e.ExtendedProperties.ContainsKey(Constants.EditableChild)))
            {
                if (!EditableChildEntities.Contains(entity))
                {
                    EditableChildEntities.Add(entity);
                }
            }

            //EditableChild
            foreach (var entity in GetExcludedEntities(entities).Where(e => e is TableEntity || e.ExtendedProperties.ContainsKey(Constants.EditableChild)))
            {
                if (!EditableChildEntities.Contains(entity))
                {
                    EditableChildEntities.Add(entity);
                }
            }

            //EditableChildList
            foreach (var entity in GetListEntities(entities).Values)
            {
                if (!EditableChildListEntities.Contains(entity))
                {
                    EditableChildListEntities.Add(entity);
                }
            }
        }