Exemple #1
0
        internal static NormalizedName NameNormalizer(EFElement parent, string refName)
        {
            Debug.Assert(parent != null, "parent should not be null");

            NormalizedName normalizedName = null;

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

            var modfunc = parent as ModificationFunction;

            if (modfunc != null)
            {
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(modfunc, refName);
            }
            else
            {
                var parentItem = parent;
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentItem, refName);
            }

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

            return(normalizedName);
        }
Exemple #2
0
        internal static NormalizedName NameNormalizer(EFElement parent, string refName)
        {
            Debug.Assert(parent != null, "parent should not be null");

            NormalizedName normalizedName = null;

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

            var parentEndProperty = parent as EndProperty;

            if (parentEndProperty != null)
            {
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentEndProperty, refName);
            }
            else
            {
                var parentItem = parent;
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentItem, refName);
            }

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

            return(normalizedName);
        }
Exemple #3
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;

            var parentAssociation           = parent as Association;
            var parentAssociationSet        = parent as AssociationSet;
            var parentAssociationSetMapping = parent as AssociationSetMapping;
            var parentNavigationProperty    = parent as NavigationProperty;

            if (parentAssociation != null)
            {
                var model = parentAssociation.Parent as BaseEntityModel;
                if (model != null)
                {
                    // we are coming up with the object's name for the first time
                    var symbol = new Symbol(model.NamespaceValue, parentAssociation.LocalName.Value);
                    normalizedName = new NormalizedName(symbol, null, null, parentAssociation.LocalName.Value);
                }
            }
            else if (parentAssociationSet != null)
            {
                // we are wanting to resolve a reference from an Association Set that may or may not
                // use the alias defined in the EntityModel
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentAssociationSet, refName);
            }
            else if (parentAssociationSetMapping != null)
            {
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentAssociationSetMapping, refName);
            }
            else if (parentNavigationProperty != null)
            {
                normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentNavigationProperty, refName);
            }

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

            return(normalizedName);
        }
        // an example use of an alias in a typename
        //
        //  <Alias cdm:Key="CNorthwind" cdm:Value="Test.Simple.Model" />
        //  ...
        //    <EntityTypeMapping cdm:TypeName="CNorthwind.CCategory">
        //      ...
        //
        // we need to resolve CNorthwind.CCategory to Test.Simple.Model.CCategory so we
        // can look it up in the symbol table
        internal static NormalizedName NameNormalizer(EFElement parent, string refName)
        {
            Debug.Assert(parent != null, "parent should not be null");

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

            // go get the needed parent objects
            var parentItem = parent;

            Debug.Assert(parentItem != null, "parent should not be an EFElement");

            refName = refName.Trim();
            refName = EntityTypeMapping.StripOffIsTypeOf(refName);

            return(EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentItem, refName));
        }
Exemple #5
0
 internal static NormalizedName FunctionNameNormalizer(EFElement parent, string refName)
 {
     return(EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parent, refName));
 }