/// <exclude />
        protected override void OnInitialize()
        {
            if (this.InterfaceType != null && !typeof(IData).IsAssignableFrom(this.InterfaceType))
            {
                AddValidationError("TreeValidationError.Common.NotImplementingIData", this.InterfaceType, typeof(IData));
            }

            this.ParentIdEntries = new List <ParentIdEntry>();

            IEnumerable <TreeNode> treeNodes = this.OwnerNode.Descendants(true).ToList();

            foreach (TreeNode treeNode in treeNodes)
            {
                DataFilteringTreeNode dataFilteringTreeNode = treeNode as DataFilteringTreeNode;

                if (dataFilteringTreeNode == null)
                {
                    continue;
                }

                IEnumerable <ParentIdFilterNode> parentIdFilterNodes = dataFilteringTreeNode.FilterNodes.OfType <ParentIdFilterNode>().Evaluate();
                if (!parentIdFilterNodes.Any())
                {
                    continue;
                }

                foreach (ParentIdFilterNode parentIdFilterNode in parentIdFilterNodes)
                {
                    Type interfaceType = parentIdFilterNode.ParentFilterType;

                    IEnumerable <ForeignPropertyInfo> foreignPropertyInfos = DataReferenceFacade.GetForeignKeyProperties(this.InterfaceType, interfaceType);

                    foreach (ForeignPropertyInfo foreignPropertyInfo in foreignPropertyInfos)
                    {
                        var parentIdEntry = new ParentIdEntry(
                            interfaceType,
                            foreignPropertyInfo.TargetKeyPropertyInfo,
                            foreignPropertyInfo.SourcePropertyName
                            );

                        if (!this.ParentIdEntries.Contains(parentIdEntry))
                        {
                            this.ParentIdEntries.Add(parentIdEntry);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(this.CustomFormMarkupPath))
            {
                this.CustomFormMarkupPath = LoadAndValidateCustomFormMarkupPath(CustomFormMarkupPath);
            }
        }
            private bool Equals(ParentIdEntry parentIdEntry)
            {
                if (parentIdEntry == null)
                {
                    return(false);
                }

                return
                    (parentIdEntry.TargetInterface == this.TargetInterface &&
                     parentIdEntry.TargetPropertyInfo == this.TargetPropertyInfo &&
                     parentIdEntry.SourcePropertyName == this.SourcePropertyName);
            }
        /// <exclude />
        protected override void OnInitialize()
        {
            if (this.InterfaceType != null && !typeof(IData).IsAssignableFrom(this.InterfaceType))
            {
                AddValidationError("TreeValidationError.Common.NotImplementingIData", this.InterfaceType, typeof(IData));
            }

            this.ParentIdEntries = new List<ParentIdEntry>();

            IEnumerable<TreeNode> treeNodes = this.OwnerNode.Descendants(true).ToList();
            foreach (TreeNode treeNode in treeNodes)
            {
                DataFilteringTreeNode dataFilteringTreeNode = treeNode as DataFilteringTreeNode;

                if (dataFilteringTreeNode == null) continue;

                IEnumerable<ParentIdFilterNode> parentIdFilterNodes = dataFilteringTreeNode.FilterNodes.OfType<ParentIdFilterNode>().Evaluate();
                if (!parentIdFilterNodes.Any()) continue;

                foreach (ParentIdFilterNode parentIdFilterNode in parentIdFilterNodes)
                {
                    Type interfaceType = parentIdFilterNode.ParentFilterType;

                    IEnumerable<ForeignPropertyInfo> foreignPropertyInfos = DataReferenceFacade.GetForeignKeyProperties(this.InterfaceType, interfaceType);

                    foreach (ForeignPropertyInfo foreignPropertyInfo in foreignPropertyInfos)
                    {
                        var parentIdEntry = new ParentIdEntry(
                            interfaceType,
                            foreignPropertyInfo.TargetKeyPropertyInfo,
                            foreignPropertyInfo.SourcePropertyName
                        );

                        if (!this.ParentIdEntries.Contains(parentIdEntry))
                        {
                            this.ParentIdEntries.Add(parentIdEntry);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(this.CustomFormMarkupPath))
            {
                this.CustomFormMarkupPath = LoadAndValidateCustomFormMarkupPath(CustomFormMarkupPath);
            }
        }
            private bool Equals(ParentIdEntry parentIdEntry)
            {
                if (parentIdEntry == null) return false;

                return
                    parentIdEntry.TargetInterface == this.TargetInterface &&
                    parentIdEntry.TargetPropertyInfo == this.TargetPropertyInfo &&
                    parentIdEntry.SourcePropertyName == this.SourcePropertyName;
            }
        /// <exclude />
        protected override void OnInitialize()
        {
            if ((this.InterfaceType != null) && (typeof(IData).IsAssignableFrom(this.InterfaceType) == false))
            {
                AddValidationError("TreeValidationError.Common.NotImplementingIData", this.InterfaceType, typeof(IData));
            }

            this.ParentIdEntrys = new List <ParentIdEntry>();

            IEnumerable <TreeNode> treeNodes = this.OwnerNode.Descendants(true).ToList();

            foreach (TreeNode treeNode in treeNodes)
            {
                DataFilteringTreeNode dataFilteringTreeNode = treeNode as DataFilteringTreeNode;

                if (dataFilteringTreeNode == null)
                {
                    continue;
                }

                IEnumerable <ParentIdFilterNode> parentIdFilterNodes = dataFilteringTreeNode.FilterNodes.OfType <ParentIdFilterNode>();
                if (parentIdFilterNodes.Count() == 0)
                {
                    continue;
                }

                foreach (ParentIdFilterNode parentIdFilterNode in parentIdFilterNodes)
                {
                    Type interfaceType = parentIdFilterNode.ParentFilterType;

                    IEnumerable <ForeignPropertyInfo> foreignPropertyInfos = DataReferenceFacade.GetForeignKeyProperties(this.InterfaceType, interfaceType);

                    foreach (ForeignPropertyInfo foreignPropertyInfo in foreignPropertyInfos)
                    {
                        ParentIdEntry parentIdEntry = new ParentIdEntry
                        {
                            TargetInterface    = interfaceType,
                            TargetPropertyInfo = foreignPropertyInfo.TargetKeyPropertyInfo,
                            SourcePropertyName = foreignPropertyInfo.SourcePropertyName
                        };

                        if (this.ParentIdEntrys.Contains(parentIdEntry) == false)
                        {
                            this.ParentIdEntrys.Add(parentIdEntry);
                        }
                    }
                }
            }

            if (string.IsNullOrEmpty(this.CustomFormMarkupPath) == false)
            {
                try
                {
                    string path = PathUtil.Resolve(this.CustomFormMarkupPath);
                    if (C1File.Exists(path) == false)
                    {
                        AddValidationError("TreeValidationError.GenericAddDataAction.MissingMarkupFile", path);
                    }

                    XDocument document = XDocumentUtils.Load(path);

                    this.CustomFormMarkupPath = path;
                }
                catch
                {
                    AddValidationError("TreeValidationError.GenericAddDataAction.BadMarkupPath", this.CustomFormMarkupPath);
                }
            }
        }
        /// <exclude />
        protected override void OnInitialize()
        {
            if ((this.InterfaceType != null) && (typeof(IData).IsAssignableFrom(this.InterfaceType) == false))
            {
                AddValidationError("TreeValidationError.Common.NotImplementingIData", this.InterfaceType, typeof(IData));
            }

            this.ParentIdEntrys = new List<ParentIdEntry>();

            IEnumerable<TreeNode> treeNodes = this.OwnerNode.Descendants(true).ToList();
            foreach (TreeNode treeNode in treeNodes)
            {
                DataFilteringTreeNode dataFilteringTreeNode = treeNode as DataFilteringTreeNode;

                if (dataFilteringTreeNode == null) continue;

                IEnumerable<ParentIdFilterNode> parentIdFilterNodes = dataFilteringTreeNode.FilterNodes.OfType<ParentIdFilterNode>();
                if (parentIdFilterNodes.Count() == 0) continue;

                foreach (ParentIdFilterNode parentIdFilterNode in parentIdFilterNodes)
                {
                    Type interfaceType = parentIdFilterNode.ParentFilterType;

                    IEnumerable<ForeignPropertyInfo> foreignPropertyInfos = DataReferenceFacade.GetForeignKeyProperties(this.InterfaceType, interfaceType);

                    foreach (ForeignPropertyInfo foreignPropertyInfo in foreignPropertyInfos)
                    {
                        ParentIdEntry parentIdEntry = new ParentIdEntry
                        {
                            TargetInterface = interfaceType,
                            TargetPropertyInfo = foreignPropertyInfo.TargetKeyPropertyInfo,
                            SourcePropertyName = foreignPropertyInfo.SourcePropertyName
                        };

                        if (this.ParentIdEntrys.Contains(parentIdEntry) == false)
                        {
                            this.ParentIdEntrys.Add(parentIdEntry);
                        }
                    }
                }
            }

            if (string.IsNullOrEmpty(this.CustomFormMarkupPath) == false)
            {
                try
                {
                    string path = PathUtil.Resolve(this.CustomFormMarkupPath);
                    if (C1File.Exists(path) == false)
                    {
                        AddValidationError("TreeValidationError.GenericAddDataAction.MissingMarkupFile", path);
                    }

                    XDocument document = XDocumentUtils.Load(path);

                    this.CustomFormMarkupPath = path;
                }
                catch
                {
                    AddValidationError("TreeValidationError.GenericAddDataAction.BadMarkupPath", this.CustomFormMarkupPath);
                }
            }
        }