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); }
protected override void ProcessPreReqCommands() { var prereq = GetPreReqCommand(CreateFunctionComplexPropertyCommand.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"); } }
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); }
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); } }
internal static void ValidateFunctionComplexProperty(FunctionComplexProperty fcp) { ValidateEFElement(fcp); }