internal override bool ParseSingleElement(ICollection <XName> unprocessedElements, XElement elem)
        {
            if (elem.Name.LocalName == FunctionScalarProperty.ElementName)
            {
                var prop = new FunctionScalarProperty(this, elem);
                _scalarProperties.Add(prop);
                prop.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == FunctionComplexProperty.ElementName)
            {
                var prop = new FunctionComplexProperty(this, elem);
                _complexProperties.Add(prop);
                prop.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == FunctionAssociationEnd.ElementName)
            {
                var end = new FunctionAssociationEnd(this, elem);
                _ends.Add(end);
                end.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == ResultBinding.ElementName)
            {
                var resultBinding = new ResultBinding(this, elem);
                _resultBindings.Add(resultBinding);
                resultBinding.Parse(unprocessedElements);
            }
            else
            {
                return(base.ParseSingleElement(unprocessedElements, elem));
            }

            return(true);
        }
        protected override void ProcessPreReqCommands()
        {
            var prereq = GetPreReqCommand(PrereqId) as CreateFunctionComplexPropertyCommand;
            if (prereq != null)
            {
                _parentComplexProperty = prereq.FunctionComplexProperty;
                CommandValidation.ValidateFunctionComplexProperty(_parentComplexProperty);

                Debug.Assert(_parentComplexProperty != null, "We didn't get a good FunctionComplexProperty out of the pre-req Command");
            }

            base.ProcessPreReqCommands();
        }
Пример #3
0
 internal override bool ParseSingleElement(ICollection <XName> unprocessedElements, XElement elem)
 {
     if (elem.Name.LocalName == FunctionScalarProperty.ElementName)
     {
         var prop = new FunctionScalarProperty(this, elem);
         _scalarProperties.Add(prop);
         prop.Parse(unprocessedElements);
     }
     else if (elem.Name.LocalName == ElementName)
     {
         var complexProperty = new FunctionComplexProperty(this, elem);
         _complexProperties.Add(complexProperty);
         complexProperty.Parse(unprocessedElements);
     }
     else
     {
         return(base.ParseSingleElement(unprocessedElements, elem));
     }
     return(true);
 }
Пример #4
0
        /// <summary>
        ///     Normalize a refName where the refName is a child of a FunctionComplexProperty
        /// </summary>
        /// <param name="fcp"></param>
        /// <param name="refName"></param>
        /// <returns></returns>
        internal static NormalizedName NormalizeNameRelativeToFunctionComplexProperty(FunctionComplexProperty fcp, string refName)
        {
            NormalizedName nn = null;

            if (fcp != null)
            {
                // for FunctionComplexProperty mapping we create Symbol from corresponding ComplexType
                if (fcp.Name.Status == BindingStatus.Known)
                {
                    var complexType = fcp.Name.Target.ComplexType.Target;
                    if (complexType != null)
                    {
                        var symbol = new Symbol(complexType.NormalizedName, refName);
                        nn = new NormalizedName(symbol, null, null, refName);
                    }
                }
            }
            return(nn);
        }
Пример #5
0
 internal void AddComplexProperty(FunctionComplexProperty prop)
 {
     _complexProperties.Add(prop);
 }
 private void PreserveFunctionComplexPropertyMapping(
     CommandProcessorContext cpc, FunctionComplexProperty fcp, ComplexConceptualProperty createdComplexTypeProperty)
 {
     // walk the Properties tree
     foreach (var fsp in fcp.ScalarProperties())
     {
         PreserveFunctionScalarPropertyMapping(cpc, fsp, createdComplexTypeProperty);
     }
     foreach (var childFcp in fcp.ComplexProperties())
     {
         PreserveFunctionComplexPropertyMapping(cpc, childFcp, createdComplexTypeProperty);
     }
 }
        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            // check ModificationFunction or ComplexProperty parent exists
            Debug.Assert(
                _parentModificationFunction != null || _parentComplexProperty != null,
                "Must have either a ModificationFunction or a ComplexProperty parent to house this ComplexProperty");
            if (_parentModificationFunction == null
                && _parentComplexProperty == null)
            {
                throw new CannotLocateParentItemException();
            }

            // check both ModificationFunction and ComplexProperty parents don't exist
            Debug.Assert(
                _parentModificationFunction == null || _parentComplexProperty == null,
                "Must not have both a ModificationFunction and a ComplexProperty parent to house this ComplexProperty");
            if (_parentModificationFunction != null
                && _parentComplexProperty != null)
            {
                throw new CannotLocateParentItemException();
            }

            if (_parentModificationFunction != null)
            {
                _createdProperty = CreateComplexPropertyUsingModificationFunction(_parentModificationFunction, _property);
            }
            else if (_parentComplexProperty != null)
            {
                _createdProperty = CreateComplexPropertyUsingComplexProperty(_parentComplexProperty, _property);
            }

            Debug.Assert(_createdProperty != null, "Failed to create a FunctionComplexProperty");
        }
        private static FunctionComplexProperty CreateNewFunctionComplexProperty(EFElement parent, ComplexConceptualProperty property)
        {
            Debug.Assert(property != null, 
                "CreateFunctionComplexPropertyCommand.CreateNewFunctionComplexProperty() received null property");
            Debug.Assert
                (property.ComplexType.Target != null,
                 typeof(CreateFunctionComplexPropertyCommand).Name
                    + ".CreateNewFunctionComplexProperty() received property with null ComplexType.Target");

            // actually create it in the XLinq tree
            var fcp = new FunctionComplexProperty(parent, null);
            fcp.Name.SetRefName(property);
            fcp.TypeName.SetRefName(property.ComplexType.Target);

            XmlModelHelper.NormalizeAndResolve(fcp);

            if (fcp == null)
            {
                throw new ItemCreationFailureException();
            }

            Debug.Assert(
                fcp.Name.Target != null && fcp.Name.Target.LocalName.Value == fcp.Name.RefName,
                (fcp.Name.Target == null
                     ? "Broken property resolution for FunctionComplexProperty " + fcp.ToPrettyString() + ": null Target"
                     : "Broken property resolution for FunctionComplexProperty " + fcp.ToPrettyString() + ": Target.LocalName = "
                       + fcp.Name.Target.LocalName.Value + ", RefName = " + fcp.Name.RefName));

            return fcp;
        }
 private static FunctionComplexProperty CreateComplexPropertyUsingComplexProperty(
     FunctionComplexProperty parentComplexProperty, ComplexConceptualProperty property)
 {
     // make sure that we don't already have one
     var fcp = parentComplexProperty.FindFunctionComplexProperty(property);
     if (fcp == null)
     {
         fcp = CreateNewFunctionComplexProperty(parentComplexProperty, property);
         parentComplexProperty.AddComplexProperty(fcp);
     }
     return fcp;
 }
 /// <summary>
 ///     Normalize a refName where the refName is a child of a FunctionComplexProperty
 /// </summary>
 /// <param name="fcp"></param>
 /// <param name="refName"></param>
 /// <returns></returns>
 internal static NormalizedName NormalizeNameRelativeToFunctionComplexProperty(FunctionComplexProperty fcp, string refName)
 {
     NormalizedName nn = null;
     if (fcp != null)
     {
         // for FunctionComplexProperty mapping we create Symbol from corresponding ComplexType
         if (fcp.Name.Status == BindingStatus.Known)
         {
             var complexType = fcp.Name.Target.ComplexType.Target;
             if (complexType != null)
             {
                 var symbol = new Symbol(complexType.NormalizedName, refName);
                 nn = new NormalizedName(symbol, null, null, refName);
             }
         }
     }
     return nn;
 }
Пример #11
0
 internal static void ValidateFunctionComplexProperty(FunctionComplexProperty fcp)
 {
     ValidateEFElement(fcp);
 }
 internal void AddComplexProperty(FunctionComplexProperty prop)
 {
     _complexProperties.Add(prop);
 }
 internal override bool ParseSingleElement(ICollection<XName> unprocessedElements, XElement elem)
 {
     if (elem.Name.LocalName == FunctionScalarProperty.ElementName)
     {
         var prop = new FunctionScalarProperty(this, elem);
         _scalarProperties.Add(prop);
         prop.Parse(unprocessedElements);
     }
     else if (elem.Name.LocalName == ElementName)
     {
         var complexProperty = new FunctionComplexProperty(this, elem);
         _complexProperties.Add(complexProperty);
         complexProperty.Parse(unprocessedElements);
     }
     else
     {
         return base.ParseSingleElement(unprocessedElements, elem);
     }
     return true;
 }
        internal override bool ParseSingleElement(ICollection<XName> unprocessedElements, XElement elem)
        {
            if (elem.Name.LocalName == FunctionScalarProperty.ElementName)
            {
                var prop = new FunctionScalarProperty(this, elem);
                _scalarProperties.Add(prop);
                prop.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == FunctionComplexProperty.ElementName)
            {
                var prop = new FunctionComplexProperty(this, elem);
                _complexProperties.Add(prop);
                prop.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == FunctionAssociationEnd.ElementName)
            {
                var end = new FunctionAssociationEnd(this, elem);
                _ends.Add(end);
                end.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == ResultBinding.ElementName)
            {
                var resultBinding = new ResultBinding(this, elem);
                _resultBindings.Add(resultBinding);
                resultBinding.Parse(unprocessedElements);
            }
            else
            {
                return base.ParseSingleElement(unprocessedElements, elem);
            }

            return true;
        }