internal override bool ParseSingleElement(ICollection<XName> unprocessedElements, XElement element)
 {
     if (element.Name.LocalName == "Connection")
     {
         DesignerInfo connectionDesignerInfo = new ConnectionDesignerInfo(this, element);
         connectionDesignerInfo.Parse(unprocessedElements);
         _designerInfos.Add(element.Name.LocalName, connectionDesignerInfo);
     }
     else if (element.Name.LocalName == OptionsDesignerInfo.ElementName)
     {
         DesignerInfo optionsDesignerInfo = new OptionsDesignerInfo(this, element);
         optionsDesignerInfo.Parse(unprocessedElements);
         _designerInfos.Add(element.Name.LocalName, optionsDesignerInfo);
     }
     else if (_diagramArtifact == null
              && element.Name.LocalName == Diagrams.ElementName) // only parse Diagrams element if DiagramArtifact is not available.
     {
         _diagrams = new Diagrams(this, element);
         _diagrams.Parse(unprocessedElements);
     }
     else
     {
         return base.ParseSingleElement(unprocessedElements, element);
     }
     return true;
 }
Esempio n. 2
0
        private DesignerInfo SetupOptionsDesignerInfo(string designerPropertyName, string designerPropertyValue)
        {
            var designerInfo =
                new OptionsDesignerInfo(
                    null,
                    XElement.Parse(
                        "<Options xmlns='http://schemas.microsoft.com/ado/2009/11/edmx' />"));
            var designerInfoPropertySet =
                new DesignerInfoPropertySet(
                    designerInfo,
                    XElement.Parse(
                        "<DesignerInfoPropertySet xmlns='http://schemas.microsoft.com/ado/2009/11/edmx' />"));
            if (designerPropertyName != null)
            {
                var designerProperty =
                    new DesignerProperty(
                        designerInfoPropertySet,
                        XElement.Parse(
                            "<DesignerProperty Name='" + designerPropertyName + "' Value='" +
                            designerPropertyValue +
                            "' xmlns='http://schemas.microsoft.com/ado/2009/11/edmx' />"));
                designerInfoPropertySet.AddDesignerProperty(designerPropertyName, designerProperty);
            }

            designerInfo.PropertySet = designerInfoPropertySet;
            return designerInfo;
        }
 // <summary>
 //     Returns a Command to update a value of a designer property
 // </summary>
 private static void AddUpdateDesignerPropertyCommand(
     DesignerProperty property, string propertyName, bool checkBoxValue, OptionsDesignerInfo optionsDesignerInfo,
     List<Command> commands)
 {
     if (property == null
         || property.ValueAttr == null
         || checkBoxValue != bool.Parse(property.ValueAttr.Value))
     {
         var value = checkBoxValue ? Boolean.TrueString : Boolean.FalseString;
         var cmd = new ChangeDesignerPropertyCommand(propertyName, value, optionsDesignerInfo);
         commands.Add(cmd);
     }
 }