Ejemplo n.º 1
0
        internal override void ConstructResolvedTraits(ResolvedTraitSetBuilder rtsb, ResolveOptions resOpt)
        {
            // base traits then add any elevated from attributes then add things exhibited by the att.
            CdmObjectReference baseClass = this.ExtendsEntityRef;

            if (baseClass != null)
            {
                // merge in all from base class
                rtsb.MergeTraits((baseClass as CdmObjectReferenceBase).FetchResolvedTraits(resOpt));
            }

            if (this.Attributes != null)
            {
                ResolvedTraitSet rtsElevated = new ResolvedTraitSet(resOpt);
                for (int i = 0; i < this.Attributes.Count; i++)
                {
                    dynamic att    = this.Attributes.AllItems[i];
                    dynamic rtsAtt = att.FetchResolvedTraits(resOpt);
                    if (rtsAtt?.HasElevated == true)
                    {
                        rtsElevated = rtsElevated.MergeSet(rtsAtt, true);
                    }
                }
                rtsb.MergeTraits(rtsElevated);
            }
            this.ConstructResolvedTraitsDef(null, rtsb, resOpt);
        }
Ejemplo n.º 2
0
        public static dynamic ToData(CdmObjectReference instance, ResolveOptions resOpt, CopyOptions options)
        {
            dynamic copy = null;

            if (!string.IsNullOrEmpty(instance.NamedReference))
            {
                dynamic identifier = Utils.CopyIdentifierRef(instance, resOpt, options);
                if (instance.SimpleNamedReference)
                {
                    return(identifier);
                }
                dynamic replace = CopyRefData(instance, resOpt, copy, identifier, options);
                if (replace != null)
                {
                    copy = replace;
                }
            }
            else if (instance.ExplicitReference != null)
            {
                dynamic erCopy  = instance.ExplicitReference.CopyData(resOpt, options);
                dynamic replace = CopyRefData(instance, resOpt, copy, erCopy, options);
                if (replace != null)
                {
                    copy = replace;
                }
            }
            if (instance.AppliedTraits.Count > 0)
            {
                copy.AppliedTraits = CopyDataUtils.ListCopyData(resOpt, instance.AppliedTraits, options);
            }
            return(copy);
        }
Ejemplo n.º 3
0
        internal static CdmAttributeContext CreateChildUnder(ResolveOptions resOpt, AttributeContextParameters acp)
        {
            if (acp == null)
            {
                return(null);
            }

            if (acp.type == CdmAttributeContextType.PassThrough)
            {
                return(acp.under);
            }

            // this flag makes sure we hold on to any resolved object refs when things get copied
            resOpt.SaveResolutionsOnCopy = true;

            CdmObjectReference definition = null;
            ResolvedTraitSet   rtsApplied = null;

            // get a simple reference to definition object to avoid getting the traits that might be part of this ref
            // included in the link to the definition.
            if (acp.Regarding != null)
            {
                // make a portable reference. this MUST be fixed up when the context node lands in the final document
                definition = (acp.Regarding as CdmObjectBase).CreatePortableReference(resOpt);
                // now get the traits applied at this reference (applied only, not the ones that are part of the definition of the object)
                // and make them the traits for this context
                if (acp.IncludeTraits)
                {
                    rtsApplied = (acp.Regarding as CdmObjectBase).FetchResolvedTraits(resOpt);
                }
            }

            CdmAttributeContext underChild = acp.under.Ctx.Corpus.MakeObject <CdmAttributeContext>(CdmObjectType.AttributeContextDef, acp.Name);

            // need context to make this a 'live' object
            underChild.Ctx        = acp.under.Ctx;
            underChild.InDocument = acp.under.InDocument;
            underChild.Type       = acp.type;
            underChild.Definition = definition;
            // add traits if there are any
            if (rtsApplied?.Set != null)
            {
                rtsApplied.Set.ForEach(rt =>
                {
                    var traitRef = CdmObjectBase.ResolvedTraitToTraitRef(resOpt, rt);
                    underChild.ExhibitsTraits.Add(traitRef);
                });
            }

            // add to parent
            underChild.SetParent(resOpt, acp.under);

            if (resOpt.MapOldCtxToNewCtx != null)
            {
                resOpt.MapOldCtxToNewCtx[underChild] = underChild; // so we can find every node, not only the replaced ones
            }

            return(underChild);
        }
Ejemplo n.º 4
0
        internal static CdmAttributeContext CreateChildUnder(ResolveOptions resOpt, AttributeContextParameters acp)
        {
            if (acp == null)
            {
                return(null);
            }

            if (acp.type == CdmAttributeContextType.PassThrough)
            {
                return(acp.under as CdmAttributeContext);
            }

            // this flag makes sure we hold on to any resolved object refs when things get copied
            ResolveOptions resOptCopy = CdmObjectBase.CopyResolveOptions(resOpt);

            resOptCopy.SaveResolutionsOnCopy = true;

            CdmObjectReference definition = null;
            ResolvedTraitSet   rtsApplied = null;

            // get a simple reference to definition object to avoid getting the traits that might be part of this ref
            // included in the link to the definition.
            if (acp.Regarding != null)
            {
                definition            = acp.Regarding.CreateSimpleReference(resOptCopy);
                definition.InDocument = acp.under.InDocument; // ref is in same doc as context
                // now get the traits applied at this reference (applied only, not the ones that are part of the definition of the object)
                // and make them the traits for this context
                if (acp.IncludeTraits)
                {
                    rtsApplied = (acp.Regarding as CdmObjectBase).FetchResolvedTraits(resOptCopy);
                }
            }

            CdmAttributeContext underChild = acp.under.Ctx.Corpus.MakeObject <CdmAttributeContext>(CdmObjectType.AttributeContextDef, acp.Name);

            // need context to make this a 'live' object
            underChild.Ctx        = acp.under.Ctx;
            underChild.InDocument = (acp.under as CdmAttributeContext).InDocument;
            underChild.Type       = acp.type;
            underChild.Definition = definition;
            // add traits if there are any
            if (rtsApplied?.Set != null)
            {
                rtsApplied.Set.ForEach(rt =>
                {
                    var traitRef = CdmObjectBase.ResolvedTraitToTraitRef(resOptCopy, rt);
                    underChild.ExhibitsTraits.Add(traitRef);
                });
            }

            // add to parent
            underChild.SetParent(resOptCopy, acp.under as CdmAttributeContext);

            return(underChild);
        }
Ejemplo n.º 5
0
        internal bool IsDerivedFromDef(ResolveOptions resOpt, CdmObjectReference baseCdmObjectRef, string name, string seek)
        {
            if (seek == name)
            {
                return(true);
            }

            CdmObjectDefinition def = baseCdmObjectRef?.FetchObjectDefinition <CdmObjectDefinition>(resOpt);

            if (def != null)
            {
                return(def.IsDerivedFrom(seek, resOpt));
            }
            return(false);
        }
Ejemplo n.º 6
0
 internal void ConstructResolvedTraitsDef(CdmObjectReference baseCdmObjectRef, ResolvedTraitSetBuilder rtsb, ResolveOptions resOpt)
 {
     // get from base public class first, then see if some are applied to base public class on ref then add dynamic traits exhibited by this def
     if (baseCdmObjectRef != null)
     {
         // merge in all from base class
         rtsb.MergeTraits((baseCdmObjectRef as CdmObjectReferenceBase).FetchResolvedTraits(resOpt));
     }
     // merge in dynamic that are exhibited by this class
     if (this.ExhibitsTraits != null)
     {
         foreach (CdmTraitReference exhibitsTrait in this.ExhibitsTraits)
         {
             rtsb.MergeTraits(exhibitsTrait.FetchResolvedTraits(resOpt));
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a copy of the reference object
        /// </summary>
        public static dynamic CopyIdentifierRef(CdmObjectReference objRef, ResolveOptions resOpt, CopyOptions options)
        {
            string identifier = objRef.NamedReference;

            if (options == null || options.StringRefs == null || options.StringRefs == false)
            {
                return(identifier);
            }

            CdmObjectDefinition resolved = objRef.FetchObjectDefinition <CdmObjectDefinition>(resOpt);

            if (resolved == null)
            {
                return(identifier);
            }

            return(new { AtCorpusPath = resolved.AtCorpusPath, Identifier = identifier });
        }
Ejemplo n.º 8
0
        private static dynamic CopyRefData(CdmObjectReference instance, ResolveOptions resOpt, dynamic copy, dynamic refTo, CopyOptions options)
        {
            switch (instance.ObjectType)
            {
            case CdmObjectType.AttributeGroupRef:
                return(new AttributeGroupReferenceDefinition {
                    AttributeGroupReference = JToken.FromObject(refTo, JsonSerializationUtil.JsonSerializer)
                });

            case CdmObjectType.AttributeRef:
                return(refTo);

            case CdmObjectType.DataTypeRef:
                return(new DataTypeReferenceDefinition {
                    DataTypeReference = refTo
                });

            case CdmObjectType.EntityRef:
                return(new EntityReferenceDefinition {
                    EntityReference = JToken.FromObject(refTo, JsonSerializationUtil.JsonSerializer)
                });

            case CdmObjectType.PurposeRef:
                return(new PurposeReferenceDefinition {
                    PurposeReference = refTo
                });

            case CdmObjectType.TraitRef:
                copy = new TraitReferenceDefinition();
                copy.TraitReference = refTo;
                copy.Arguments      = Utils.ListCopyData <dynamic>(resOpt, ((CdmTraitReference)instance).Arguments, options)?.ConvertAll <JToken>(a => JToken.FromObject(a, JsonSerializationUtil.JsonSerializer));
                return(copy);

            case CdmObjectType.TraitGroupRef:
                return(new TraitGroupReferenceDefinition {
                    TraitGroupReference = refTo
                });
            }

            return(null);
        }
        public ProjectionDirective(ResolveOptions resOpt, CdmObjectDefinitionBase owner, CdmObjectReference ownerRef = null)
        {
            this.ResOpt = resOpt;

            // Owner information
            this.Owner     = owner;
            this.OwnerRef  = ownerRef;
            this.OwnerType = (owner != null) ? owner.ObjectType : CdmObjectType.Error;

            if (owner?.ObjectType == CdmObjectType.EntityAttributeDef)
            {
                // Entity Attribute

                CdmEntityAttributeDefinition _owner = (CdmEntityAttributeDefinition)owner;
                this.Cardinality         = _owner.Cardinality != null ? _owner.Cardinality : new CardinalitySettings(_owner);
                this.IsSourcePolymorphic = (_owner.IsPolymorphicSource != null && _owner.IsPolymorphicSource == true);
            }
            else
            {
                // Entity Def

                this.Cardinality         = null;
                this.IsSourcePolymorphic = false;
            }

            this.IsReferenceOnly   = (resOpt.Directives?.Has("referenceOnly") == true);
            this.IsNormalized      = (resOpt.Directives?.Has("normalized") == true);
            this.IsStructured      = (resOpt.Directives?.Has("structured") == true);
            this.HasNoMaximumDepth = (resOpt.Directives?.Has("noMaxDepth") == true);
            this.IsArray           = (resOpt.Directives?.Has("isArray") == true);

            this.CurrentDepth        = (resOpt?.RelationshipDepth == null) ? 1 : resOpt.RelationshipDepth + 1;
            resOpt.RelationshipDepth = this.CurrentDepth;

            // if noMaxDepth directive the max depth is 32 else defaults to 2
            // these depths were arbitrary and were set for the resolution guidance
            // re-using the same for projections as well
            this.MaximumDepth = this.HasNoMaximumDepth ? MaxDepthHasNoMax : MaxDepthDefault;
        }
Ejemplo n.º 10
0
        public ProjectionDirective(ResolveOptions resOpt, CdmObjectDefinitionBase owner, CdmObjectReference ownerRef = null)
        {
            this.ResOpt = resOpt;

            // Owner information
            this.Owner    = owner;
            this.OwnerRef = ownerRef;

            if (owner?.ObjectType == CdmObjectType.EntityAttributeDef)
            {
                // Entity Attribute

                CdmEntityAttributeDefinition _owner = (CdmEntityAttributeDefinition)owner;
                this.Cardinality         = _owner.Cardinality != null ? _owner.Cardinality : new CardinalitySettings(_owner);
                this.IsSourcePolymorphic = (_owner.IsPolymorphicSource != null && _owner.IsPolymorphicSource == true);
            }
            else
            {
                // Entity Def or Type Attribute

                this.Cardinality         = null;
                this.IsSourcePolymorphic = false;
            }

            this.IsReferenceOnly   = (resOpt.Directives?.Has("referenceOnly") == true);
            this.IsNormalized      = (resOpt.Directives?.Has("normalized") == true);
            this.IsStructured      = (resOpt.Directives?.Has("structured") == true);
            this.IsVirtual         = (resOpt.Directives?.Has("virtual") == true);
            this.HasNoMaximumDepth = (resOpt.Directives?.Has("noMaxDepth") == true);
            this.IsArray           = (resOpt.Directives?.Has("isArray") == true);

            // if noMaxDepth directive the max depth is 32 else defaults to what was set by the user
            // these depths were arbitrary and were set for the resolution guidance
            // re-using the same for projections as well
            this.MaximumDepth = this.HasNoMaximumDepth ? DepthInfo.MaxDepthLimit : resOpt.MaxDepth;
        }
Ejemplo n.º 11
0
        internal override ResolvedAttributeSetBuilder ConstructResolvedAttributes(ResolveOptions resOpt, CdmAttributeContext under = null)
        {
            // find and cache the complete set of attributes
            // attributes definitions originate from and then get modified by subsequent re-definitions from (in this order):
            // an extended entity, traits applied to extended entity, exhibited traits of main entity, the (datatype or entity) used as an attribute, traits applied to that datatype or entity,
            // the relationsip of the attribute, the attribute definition itself and included attribute groups, dynamic traits applied to the attribute.
            this.Rasb = new ResolvedAttributeSetBuilder();
            this.Rasb.ResolvedAttributeSet.AttributeContext = under;

            if (this.ExtendsEntity != null)
            {
                CdmObjectReference         extRef          = this.ExtendsEntityRef;
                CdmAttributeContext        extendsRefUnder = null;
                AttributeContextParameters acpExtEnt       = null;

                if (under != null)
                {
                    AttributeContextParameters acpExt = new AttributeContextParameters
                    {
                        under         = under,
                        type          = CdmAttributeContextType.EntityReferenceExtends,
                        Name          = "extends",
                        Regarding     = null,
                        IncludeTraits = false
                    };
                    extendsRefUnder = this.Rasb.ResolvedAttributeSet.CreateAttributeContext(resOpt, acpExt);
                }

                if (extRef.ExplicitReference != null && extRef.FetchObjectDefinition <CdmObjectDefinition>(resOpt).ObjectType == CdmObjectType.ProjectionDef)
                {
                    // A Projection

                    CdmObjectDefinition extRefObjDef = extRef.FetchObjectDefinition <CdmObjectDefinition>(resOpt);
                    if (extendsRefUnder != null)
                    {
                        acpExtEnt = new AttributeContextParameters
                        {
                            under         = extendsRefUnder,
                            type          = CdmAttributeContextType.Projection,
                            Name          = extRefObjDef.GetName(),
                            Regarding     = extRef,
                            IncludeTraits = false
                        };
                    }

                    ProjectionDirective projDirective = new ProjectionDirective(resOpt, this, ownerRef: extRef);
                    CdmProjection       projDef       = (CdmProjection)extRefObjDef;
                    ProjectionContext   projCtx       = projDef.ConstructProjectionContext(projDirective, extendsRefUnder);

                    this.Rasb.ResolvedAttributeSet = projDef.ExtractResolvedAttributes(projCtx);
                }
                else
                {
                    // An Entity Reference

                    if (extendsRefUnder != null)
                    {
                        // usually the extended entity is a reference to a name.
                        // it is allowed however to just define the entity inline.
                        acpExtEnt = new AttributeContextParameters
                        {
                            under         = extendsRefUnder,
                            type          = CdmAttributeContextType.Entity,
                            Name          = extRef.NamedReference ?? extRef.ExplicitReference.GetName(),
                            Regarding     = extRef,
                            IncludeTraits = false
                        };
                    }

                    // save moniker, extended entity may attach a different moniker that we do not
                    // want to pass along to getting this entities attributes
                    string oldMoniker = resOpt.FromMoniker;

                    this.Rasb.MergeAttributes((this.ExtendsEntityRef as CdmObjectReferenceBase).FetchResolvedAttributes(resOpt, acpExtEnt));

                    if (!resOpt.CheckAttributeCount(this.Rasb.ResolvedAttributeSet.ResolvedAttributeCount))
                    {
                        Logger.Error(nameof(CdmEntityDefinition), this.Ctx, $"Maximum number of resolved attributes reached for the entity: {this.EntityName}.");
                        return(null);
                    }

                    if (this.ExtendsEntityResolutionGuidance != null)
                    {
                        // some guidance was given on how to integrate the base attributes into the set. apply that guidance
                        ResolvedTraitSet rtsBase = this.FetchResolvedTraits(resOpt);

                        // this context object holds all of the info about what needs to happen to resolve these attributes.
                        // make a copy and set defaults if needed
                        CdmAttributeResolutionGuidance resGuide = (CdmAttributeResolutionGuidance)this.ExtendsEntityResolutionGuidance.Copy(resOpt);
                        resGuide.UpdateAttributeDefaults(resGuide.FetchObjectDefinitionName());
                        // holds all the info needed by the resolver code
                        AttributeResolutionContext arc = new AttributeResolutionContext(resOpt, resGuide, rtsBase);

                        this.Rasb.GenerateApplierAttributes(arc, false); // true = apply the prepared traits to new atts
                    }

                    // reset to the old moniker
                    resOpt.FromMoniker = oldMoniker;
                }
            }

            this.Rasb.MarkInherited();
            this.Rasb.ResolvedAttributeSet.AttributeContext = under;

            if (this.Attributes != null)
            {
                int l = this.Attributes.Count;
                for (int i = 0; i < l; i++)
                {
                    dynamic                    att      = this.Attributes.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
                        };
                    }
                    this.Rasb.MergeAttributes(att.FetchResolvedAttributes(resOpt, acpAtt));

                    if (!resOpt.CheckAttributeCount(this.Rasb.ResolvedAttributeSet.ResolvedAttributeCount))
                    {
                        Logger.Error(nameof(CdmEntityDefinition), this.Ctx, $"Maximum number of resolved attributes reached for the entity: {this.EntityName}.");
                        return(null);
                    }
                }
            }
            this.Rasb.MarkOrder();
            this.Rasb.ResolvedAttributeSet.AttributeContext = under;

            // things that need to go away
            this.Rasb.RemoveRequestedAtts();

            return(this.Rasb);
        }
Ejemplo n.º 12
0
        public ResolvedEntityReferenceSet FetchResolvedEntityReferences(ResolveOptions resOpt = null)
        {
            bool wasPreviouslyResolving = this.Ctx.Corpus.isCurrentlyResolving;

            this.Ctx.Corpus.isCurrentlyResolving = true;
            if (resOpt == null)
            {
                resOpt = new ResolveOptions(this, this.Ctx.Corpus.DefaultResolutionDirectives);
            }

            // this whole resolved entity ref goo will go away when resolved documents are done.
            // for now, it breaks if structured att sets get made.
            resOpt            = CdmObjectBase.CopyResolveOptions(resOpt);
            resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                "normalized", "referenceOnly"
            });

            ResolveContext             ctx            = this.Ctx as ResolveContext; // what it actually is
            ResolvedEntityReferenceSet entRefSetCache = ctx.FetchCache(this, resOpt, "entRefSet") as ResolvedEntityReferenceSet;

            if (entRefSetCache == null)
            {
                entRefSetCache = new ResolvedEntityReferenceSet(resOpt);
                if (resolvingEntityReferences == false)
                {
                    resolvingEntityReferences = true;
                    // get from dynamic base public class and then 'fix' those to point here instead.
                    CdmObjectReference extRef = this.ExtendsEntityRef;
                    if (extRef != null)
                    {
                        var extDef = extRef.FetchObjectDefinition <CdmEntityDefinition>(resOpt);
                        if (extDef != null)
                        {
                            if (extDef == this)
                            {
                                extDef = extRef.FetchObjectDefinition <CdmEntityDefinition>(resOpt);
                            }
                            ResolvedEntityReferenceSet inherited = extDef.FetchResolvedEntityReferences(resOpt);
                            if (inherited != null)
                            {
                                foreach (var res in inherited.Set)
                                {
                                    ResolvedEntityReference resolvedEntityReference = res.Copy();
                                    resolvedEntityReference.Referencing.Entity = this;
                                    entRefSetCache.Set.Add(resolvedEntityReference);
                                }
                            }
                        }
                    }
                    if (this.Attributes != null)
                    {
                        for (int i = 0; i < this.Attributes.Count; i++)
                        {
                            // if dynamic refs come back from attributes, they don't know who we are, so they don't set the entity
                            dynamic sub = this.Attributes.AllItems[i].FetchResolvedEntityReferences(resOpt);
                            if (sub != null)
                            {
                                foreach (var res in sub.Set)
                                {
                                    res.Referencing.Entity = this;
                                }
                                entRefSetCache.Add(sub);
                            }
                        }
                    }
                    ctx.UpdateCache(this, resOpt, "entRefSet", entRefSetCache);
                    this.resolvingEntityReferences = false;
                }
            }
            this.Ctx.Corpus.isCurrentlyResolving = wasPreviouslyResolving;
            return(entRefSetCache);
        }
Ejemplo n.º 13
0
        internal override ResolvedAttributeSetBuilder ConstructResolvedAttributes(ResolveOptions resOpt, CdmAttributeContext under = null)
        {
            // find and cache the complete set of attributes
            // attributes definitions originate from and then get modified by subsequent re-definitions from (in this order):
            // an extended entity, traits applied to extended entity, exhibited traits of main entity, the (datatype or entity) used as an attribute, traits applied to that datatype or entity,
            // the relationsip of the attribute, the attribute definition itself and included attribute groups, dynamic traits applied to the attribute.
            this.Rasb = new ResolvedAttributeSetBuilder();
            this.Rasb.ResolvedAttributeSet.AttributeContext = under;

            if (this.ExtendsEntity != null)
            {
                CdmObjectReference         extRef          = this.ExtendsEntityRef;
                CdmAttributeContext        extendsRefUnder = null;
                AttributeContextParameters acpExtEnt       = null;
                if (under != null)
                {
                    AttributeContextParameters acpExt = new AttributeContextParameters
                    {
                        under         = under,
                        type          = CdmAttributeContextType.EntityReferenceExtends,
                        Name          = "extends",
                        Regarding     = null,
                        IncludeTraits = false
                    };
                    extendsRefUnder = this.Rasb.ResolvedAttributeSet.CreateAttributeContext(resOpt, acpExt);
                    acpExtEnt       = new AttributeContextParameters
                    {
                        under         = extendsRefUnder,
                        type          = CdmAttributeContextType.Entity,
                        Name          = extRef.NamedReference,
                        Regarding     = extRef,
                        IncludeTraits = false
                    };
                }
                // save moniker, extended entity may attach a different moniker that we do not
                // want to pass along to getting this entities attributes
                string oldMoniker = resOpt.FromMoniker;

                this.Rasb.MergeAttributes((this.ExtendsEntityRef as CdmObjectReferenceBase).FetchResolvedAttributes(resOpt, acpExtEnt));

                if (this.ExtendsEntityResolutionGuidance != null)
                {
                    // some guidance was given on how to integrate the base attributes into the set. apply that guidance
                    ResolvedTraitSet rtsBase = this.FetchResolvedTraits(resOpt);

                    // this context object holds all of the info about what needs to happen to resolve these attributes.
                    // make a copy and set defaults if needed
                    CdmAttributeResolutionGuidance resGuide = (CdmAttributeResolutionGuidance)this.ExtendsEntityResolutionGuidance.Copy(resOpt);
                    resGuide.UpdateAttributeDefaults(resGuide.FetchObjectDefinitionName());
                    // holds all the info needed by the resolver code
                    AttributeResolutionContext arc = new AttributeResolutionContext(resOpt, resGuide, rtsBase);

                    this.Rasb.GenerateApplierAttributes(arc, false); // true = apply the prepared traits to new atts
                }

                // reset to the old moniker
                resOpt.FromMoniker = oldMoniker;
            }

            this.Rasb.MarkInherited();
            this.Rasb.ResolvedAttributeSet.AttributeContext = under;

            if (this.Attributes != null)
            {
                int l = this.Attributes.Count;
                for (int i = 0; i < l; i++)
                {
                    dynamic                    att      = this.Attributes.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
                        };
                    }
                    this.Rasb.MergeAttributes(att.FetchResolvedAttributes(resOpt, acpAtt));
                }
            }
            this.Rasb.MarkOrder();
            this.Rasb.ResolvedAttributeSet.AttributeContext = under;

            // things that need to go away
            this.Rasb.RemoveRequestedAtts();

            return(this.Rasb);
        }