public override void Serialize(XElement parentNode, SerializationContext context) { base.Serialize(parentNode, context); XAttribute typeAttribute = new XAttribute("Type", SerializationContext.EncodeValue(Type)); parentNode.Add(typeAttribute); }
public override void Serialize(XElement parentNode, SerializationContext context) { base.Serialize(parentNode, context); // serialize all values of Name, incl. null and empty (both as "") { XAttribute nameAttribute = new XAttribute("Name", SerializationContext.EncodeValue(Name, true)); parentNode.Add(nameAttribute); } this.WrapAndSerializeCollection("AppliedStereotypes", "StereotypeInstance", AppliedStereotypes, parentNode, context, true); }
public override void Serialize(XElement parentNode, SerializationContext context) { base.Serialize(parentNode, context); XAttribute nameAttribute = new XAttribute("Name", SerializationContext.EncodeValue(Name)); parentNode.Add(nameAttribute); XAttribute isSealedAttribute = new XAttribute("IsSealed", SerializationContext.EncodeValue(IsSealed)); parentNode.Add(isSealedAttribute); if (BaseType != null) { this.SerializeIDRef(BaseType, "baseTypeID", parentNode, context); } if (Component != null) { this.SerializeIDRef(Component, "componentId", parentNode, context); } if (RepresentedPIMType != null) { this.SerializeIDRef(Component, "representedPIMTypeID", parentNode, context); } if (XSDDefinition != null) { XCData xsdDefinitionCData = new XCData(XSDDefinition); XElement xsdDefinitionElement = new XElement(context.ExolutioNS + "XSDDefinition"); xsdDefinitionElement.Add(xsdDefinitionCData); parentNode.Add(xsdDefinitionElement); } if (XSDAtomic) { XAttribute xsdAtomicAttribute = new XAttribute("XSDAtomic", SerializationContext.EncodeValue(true)); parentNode.Add(xsdAtomicAttribute); } this.WrapAndSerializeCollection("Operations", "Operation", Operations, parentNode, context, true); }
public void Serialize(XElement parentNode, SerializationContext context) { XElement projectElement = new XElement(context.ExolutioNS + "Project"); projectElement.Add(new XAttribute(XNamespace.Xmlns + SerializationContext.ExolutioPrefix, context.ExolutioNS.NamespaceName)); // version attribute XAttribute versionAttribute = new XAttribute("Version", "3.0"); projectElement.Add(versionAttribute); // uses versioning attribute XAttribute usesVersioningAttribute = new XAttribute("UsesVersioning", SerializationContext.EncodeValue(UsesVersioning)); projectElement.Add(usesVersioningAttribute); if (!String.IsNullOrEmpty(Name)) { XAttribute nameAttribute = new XAttribute("Name", SerializationContext.EncodeValue(Name)); projectElement.Add(nameAttribute); } if (UsesVersioning) { // versions this.WrapAndSerializeCollection("Versions", "Version", VersionManager.Versions, projectElement, context); // project versions this.WrapAndSerializeCollection("ProjectVersions", "ProjectVersion", ProjectVersions, projectElement, context); XElement versionLinksElement = new XElement(context.ExolutioNS + "VersionLinks"); VersionManager.SerializeVersionLinks(versionLinksElement, context); projectElement.Add(versionLinksElement); } else { this.SerializeToChildElement("SingleVersion", SingleVersion, projectElement, context); } context.Document.Add(projectElement); }
public override void Serialize(XElement parentNode, Serialization.SerializationContext context) { base.Serialize(parentNode, context); this.SerializeCardinality(parentNode, context); if (AttributeType != null) { this.SerializeAttributeType(AttributeType, parentNode, context, "Type"); } if (!String.IsNullOrEmpty(DefaultValue)) { XAttribute defaultValueAttribute = new XAttribute("DefaultValue", DefaultValue); parentNode.Add(defaultValueAttribute); } XAttribute elementAttribute = new XAttribute("Element", SerializationContext.EncodeValue(this.Element)); parentNode.Add(elementAttribute); this.SerializeIDRef(PSMClass, "psmClassID", parentNode, context, false); }