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);
}
}