internal override ResolvedAttributeSetBuilder ConstructResolvedAttributes(ResolveOptions resOpt, CdmAttributeContext under = null) { ResolvedAttributeSetBuilder rasb = new ResolvedAttributeSetBuilder(); AttributeContextParameters acpEnt = null; if (under != null) { acpEnt = new AttributeContextParameters { under = under, type = CdmAttributeContextType.Entity, Name = this.EntityShape.FetchObjectDefinitionName(), Regarding = this.EntityShape, IncludeTraits = true }; } if (this.EntityShape != null) { rasb.MergeAttributes(this.EntityShape.FetchResolvedAttributes(resOpt, acpEnt)); } // things that need to go away rasb.RemoveRequestedAtts(); return(rasb); }
internal override ResolvedAttributeSetBuilder ConstructResolvedAttributes(ResolveOptions resOpt, CdmAttributeContext under = null) { // find and cache the complete set of attributes ResolvedAttributeSetBuilder rasb = new ResolvedAttributeSetBuilder(); rasb.ResolvedAttributeSet.AttributeContext = under; var def = this.FetchObjectDefinition <CdmObjectDefinition>(resOpt); if (def != null) { AttributeContextParameters acpRef = null; if (under != null) { // ask for a 'pass through' context, that is, no new context at this level acpRef = new AttributeContextParameters() { under = under, type = CdmAttributeContextType.PassThrough }; } ResolvedAttributeSet resAtts = (def as CdmObjectDefinitionBase).FetchResolvedAttributes(resOpt, acpRef); if (resAtts?.Set?.Count > 0) { resAtts = resAtts.Copy(); rasb.MergeAttributes(resAtts); rasb.RemoveRequestedAtts(); } } else { string defName = this.FetchObjectDefinitionName(); Logger.Warning(defName, this.Ctx, $"unable to resolve an object from the reference '{defName}'"); } return(rasb); }
internal override ResolvedAttributeSetBuilder ConstructResolvedAttributes(ResolveOptions resOpt, CdmAttributeContext under = null) { ResolvedAttributeSetBuilder rasb = new ResolvedAttributeSetBuilder(); CdmAttributeContext allUnder = under; if (under != null) { AttributeContextParameters acpAttGrp = new AttributeContextParameters { under = under, type = CdmAttributeContextType.AttributeGroup, Name = this.GetName(), Regarding = this, IncludeTraits = false }; under = rasb.ResolvedAttributeSet.CreateAttributeContext(resOpt, acpAttGrp); } if (this.Members != null) { for (int i = 0; i < this.Members.Count; i++) { CdmObjectBase att = this.Members[i] as CdmObjectBase; AttributeContextParameters acpAtt = null; if (under != null) { acpAtt = new AttributeContextParameters { under = under, type = CdmAttributeContextType.AttributeDefinition, Name = att.FetchObjectDefinitionName(), Regarding = att, IncludeTraits = false }; } ResolvedAttributeSet rasFromAtt = att.FetchResolvedAttributes(resOpt, acpAtt); // before we just merge, need to handle the case of 'attribute restatement' AKA an entity with an attribute having the same name as an attribute // from a base entity. thing might come out with different names, if they do, then any attributes owned by a similar named attribute before // that didn't just pop out of that same named attribute now need to go away. // mark any attributes formerly from this named attribute that don't show again as orphans rasb.ResolvedAttributeSet.MarkOrphansForRemoval((att as CdmAttributeItem).FetchObjectDefinitionName(), rasFromAtt); // now merge rasb.MergeAttributes(rasFromAtt); } } rasb.ResolvedAttributeSet.AttributeContext = allUnder; // context must be the one expected from the caller's pov. // things that need to go away rasb.RemoveRequestedAtts(); return(rasb); }
internal override ResolvedAttributeSetBuilder ConstructResolvedAttributes(ResolveOptions resOpt, CdmAttributeContext under = null) { ResolvedAttributeSetBuilder rasb = new ResolvedAttributeSetBuilder(); if (under != null) { AttributeContextParameters acpAttGrp = new AttributeContextParameters { under = under, type = CdmAttributeContextType.AttributeGroup, Name = this.GetName(), Regarding = this, IncludeTraits = false }; under = rasb.ResolvedAttributeSet.CreateAttributeContext(resOpt, acpAttGrp); } if (this.Members != null) { for (int i = 0; i < this.Members.Count; i++) { dynamic att = this.Members.AllItems[i]; CdmAttributeContext attUnder = under; AttributeContextParameters acpAtt = null; if (under != null) { acpAtt = new AttributeContextParameters { under = under, type = CdmAttributeContextType.AttributeDefinition, Name = att.FetchObjectDefinitionName(), Regarding = att, IncludeTraits = false }; } rasb.MergeAttributes(att.FetchResolvedAttributes(resOpt, acpAtt)); } } rasb.ResolvedAttributeSet.AttributeContext = under; // things that need to go away rasb.RemoveRequestedAtts(); return(rasb); }