Esempio n. 1
0
        protected override void DoNormalize()
        {
            var normalizedName = AssociationNameNormalizer.NameNormalizer(this, LocalName.Value);

            Debug.Assert(null != normalizedName, "Null NormalizedName for refName " + LocalName.Value);

            NormalizedName = (normalizedName != null ? normalizedName.Symbol : Symbol.EmptySymbol);
            base.DoNormalize();
        }
Esempio n. 2
0
        internal static NormalizedName NameNormalizer(EFElement parent, string refName)
        {
            Debug.Assert(parent != null, "parent should not be null");

            if (refName == null)
            {
                return(null);
            }

            NormalizedName normalizedName = null;

            // cast the parameter to what this really is
            var end = parent as AssociationSetEnd;

            Debug.Assert(end != null, "parent should be an AssociationSetEnd");

            // get the assoc set
            var set = end.Parent as AssociationSet;

            Debug.Assert(set != null, "end.Parent should be an AssociationSet");

            // the "Role" attribute points to a "Role" attribute in an Association End.  The trick
            // is that this attribute is optional and defaults to the raw name of the Entity pointed
            // to by the "Type" attribute of the Association End, and that might not be fully resolved
            // yet.  So, lets just get the Normalized Name for the assocation from the assocation set
            //and tack on the Role name.
            if (set.Association.Status == BindingStatus.Known)
            {
                var assocNameRef          = AssociationNameNormalizer.NameNormalizer(set.Association.Target, set.Association.RefName);
                var assocSymbol           = assocNameRef.Symbol;
                var assocSetEndRoleSymbol = new Symbol(assocSymbol, refName);
                normalizedName = new NormalizedName(assocSetEndRoleSymbol, null, null, refName);
            }

            if (normalizedName == null)
            {
                var symbol = new Symbol(refName);
                normalizedName = new NormalizedName(symbol, null, null, refName);
            }

            return(normalizedName);
        }