private void _addProp(ICswNbtMetaDataProp prop) { CswNbtViewRoot.forEachRelationship eachRelationship = relationship => { //we have to iterate a temp view, but use the relationships on the "real" view relationship = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(relationship.ArbitraryId); //For property views, we ignore the top lvl relationship if ((false == (relationship.Parent is CswNbtViewRoot) && CurrentView.Visibility == CswEnumNbtViewVisibility.Property) || CurrentView.Visibility != CswEnumNbtViewVisibility.Property) { int Id = relationship.SecondId; CswEnumNbtViewRelatedIdType type = relationship.SecondType; if (relationship.PropOwner.Equals(CswEnumNbtViewPropOwnerType.First) && Int32.MinValue != relationship.FirstId && CurrentView.Visibility == CswEnumNbtViewVisibility.Property) { Id = relationship.FirstId; type = relationship.FirstType; } CswNbtViewProperty existingViewProp = relationship.findPropertyByName(prop.PropName); if (null != existingViewProp) { existingViewProp.ShowInGrid = true; } else { if (null != Request.Relationship) { int ownerTargetId = Request.Relationship.SecondId; Collection <CswNbtViewRelationship> relations = getViewChildRelationshipOptions(CurrentView, relationship.ArbitraryId); foreach (CswNbtViewRelationship related in relations) { ICswNbtMetaDataProp relProp = related.getProp(); int relatedTargetId = related.SecondId; if (ownerTargetId == relatedTargetId && Request.Relationship.getRelatedType() == related.getRelatedType()) { if (related.getRelatedType() == CswEnumNbtViewRelatedIdType.NodeTypeId) { CswNbtMetaDataNodeType ownerNT = _CswNbtResources.MetaData.getNodeType(relatedTargetId); foreach (CswNbtMetaDataNodeTypeProp ntp in ownerNT.getNodeTypeProps().Where(ntp => ntp.PropName == prop.PropName)) { CswNbtViewRelationship parentRel = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(related.ParentArbitraryId); CswNbtViewRelationship relToAddPropTo = relationship.findChildRelationshipByNodeTypeId(relatedTargetId); if (null == relToAddPropTo) { relToAddPropTo = CurrentView.AddViewRelationship(parentRel, related.PropOwner, relProp, false); } CurrentView.AddViewProperty(relToAddPropTo, ntp); } } else if (related.getRelatedType() == CswEnumNbtViewRelatedIdType.ObjectClassId) { CswNbtMetaDataObjectClass ownerOC = _CswNbtResources.MetaData.getObjectClass(relatedTargetId); foreach (CswNbtMetaDataObjectClassProp ocp in ownerOC.getObjectClassProps().Where(ocp => ocp.PropName == prop.PropName)) { CswNbtViewRelationship parentRel = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(related.ParentArbitraryId); CswNbtViewRelationship relToAddPropTo = relationship.findChildRelationshipByObjClassId(relatedTargetId); if (null == relToAddPropTo) { relToAddPropTo = CurrentView.AddViewRelationship(parentRel, related.PropOwner, relProp, false); } CurrentView.AddViewProperty(relToAddPropTo, ocp); } } else { CswNbtMetaDataPropertySet ownerPS = _CswNbtResources.MetaData.getPropertySet(relatedTargetId); foreach (CswNbtMetaDataObjectClass oc in ownerPS.getObjectClasses()) { foreach (CswNbtMetaDataNodeType nt in oc.getNodeTypes()) { foreach (CswNbtMetaDataNodeTypeProp ntp in nt.getNodeTypeProps()) { if (ntp.PropName == prop.PropName) { CswNbtViewRelationship parentRel = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(related.ParentArbitraryId); CswNbtViewRelationship relToAddPropTo = relationship.findChildRelationshipByPropSetId(relatedTargetId); if (null == relToAddPropTo) { relToAddPropTo = CurrentView.AddViewRelationship(parentRel, related.PropOwner, relProp, false); } CurrentView.AddViewProperty(relToAddPropTo, ntp); } } } } } } } } else { CswNbtViewRelationship realRelationship = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(relationship.ArbitraryId); if (type.Equals(CswEnumNbtViewRelatedIdType.NodeTypeId)) { CswNbtMetaDataNodeType nt = _CswNbtResources.MetaData.getNodeType(Id); CswNbtMetaDataNodeTypeProp ntp = nt.getNodeTypeProp(prop.PropName); if (null != ntp) { CurrentView.AddViewProperty(realRelationship, ntp); } } else if (type.Equals(CswEnumNbtViewRelatedIdType.ObjectClassId)) { CswNbtMetaDataObjectClass oc = _CswNbtResources.MetaData.getObjectClass(Id); CswNbtMetaDataObjectClassProp ocp = oc.getObjectClassProp(prop.PropName); if (null != ocp) { CurrentView.AddViewProperty(realRelationship, prop); } else { foreach (CswNbtMetaDataNodeType nt in oc.getNodeTypes()) { CswNbtMetaDataNodeTypeProp ntp = nt.getNodeTypeProp(prop.PropName); if (null != ntp) { CurrentView.AddViewProperty(realRelationship, prop); } } } } else { CswNbtMetaDataPropertySet ps = _CswNbtResources.MetaData.getPropertySet(Id); CswNbtMetaDataObjectClassProp ocp = ps.getPropertySetProps().FirstOrDefault(PropSetProp => PropSetProp.PropName == prop.PropName); if (null != ocp) { CurrentView.AddViewProperty(realRelationship, prop); } else { foreach (CswNbtMetaDataObjectClass oc in ps.getObjectClasses()) { foreach (CswNbtMetaDataNodeType nt in oc.getNodeTypes()) { CswNbtMetaDataNodeTypeProp ntp = nt.getNodeTypeProp(prop.PropName); if (null != ntp) { CurrentView.AddViewProperty(realRelationship, prop); } } } } } } } } }; CswNbtView tempView = _CswNbtResources.ViewSelect.restoreView(CurrentView.ToString()); tempView.Root.eachRelationship(eachRelationship, null); }