protected override void DeserializeValueFromXml(XmlProxy parent) { XmlProxy xmlContent = parent["content"]; this.Name = xmlContent.GetAttr("name"); InternalDeserializeFromXml(xmlContent); }
public void SerializeToXml(XmlWriter writer, string propertyName) { XmlProxy xmlRoot = new XmlProxy(propertyName); SerializeToXml(xmlRoot); XmlProxySerializer.Instance.Serialize(xmlRoot, writer); }
public string Serialize(XmlProxy item, Encoding encoding) { if (item == null) { return(string.Empty); } MemoryStream ms = new MemoryStream(); XmlWriter writer = new XmlTextWriter(ms, encoding); //writer.Formatting = Formatting.Indented; Serialize(item, writer); /*writer.Close(); * ms.Flush(); * ms.Close();*/ writer.Flush(); ms.Position = 0; string s = new StreamReader(ms).ReadToEnd(); writer.Close(); ms.Close(); return(s); }
public void SerializeToXml(XmlWriter writer) { XmlProxy xmlRoot = new XmlProxy("key"); SerializeToXml(xmlRoot); XmlProxySerializer.Instance.Serialize(xmlRoot, writer); }
protected override void DeserializeValueFromXml(XmlProxy parent) { bool currspvc = stopPropagateValueChanges; stopPropagateValueChanges = true; try { string elementValue; Type typeOfValue = GetTypeOfValue(); if (typeOfValue.IsPrimitive) { elementValue = parent.GetAttr("value"); } else { XmlProxy xmlContent = parent["value"]; elementValue = xmlContent.ElementValue; } object val = elementValue == null ? elementValue: InternalValueFromString(typeOfValue, elementValue); SetValue(val); } finally { stopPropagateValueChanges = currspvc; } }
protected override void DeserializeValueFromXml(XmlProxy parent) { XmlProxy xmlContent = parent["content"]; this.Value = new ObjectValue(); this.Value.DeserializeFromXml(xmlContent, "value"); }
public void DeserializeFromXml(XmlReader reader, string propertyName) { XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader); if (xmlRoot.ElementName == propertyName) { string strMultiplicity = xmlRoot.GetAttr("multiplicity"); MultiplicityKind multiplicityKind; if (Enum.TryParse(strMultiplicity, true, out multiplicityKind)) { this.multiplicity = multiplicityKind; } string strOnOwnerRemove = xmlRoot.GetAttr("onOwnerRemove"); AssociationOnRemoveAction onOwnerRemove; if (Enum.TryParse(strOnOwnerRemove, true, out onOwnerRemove)) { this.OnOwnerRemove = onOwnerRemove; } string strOnTargetRemove = xmlRoot.GetAttr("onTargetRemove"); AssociationOnRemoveAction onTargetRemove; if (Enum.TryParse(strOnTargetRemove, true, out onTargetRemove)) { this.OnTargetRemove = onTargetRemove; } this.UseAssociationAttribute = xmlRoot.GetAttr("useAssociationAttribute", true); XmlProxy xmlPairTo = xmlRoot["pairTo"]; this.PairTo = new Defaultable <string>(); this.PairTo.DeserializeFromXml(xmlPairTo); } }
protected override void SerializeValueToXml(XmlProxy parent) { XmlProxy xmlContent = parent.AddChild("content"); xmlContent.AddAttribute("name", Name); InternalSerializeToXml(xmlContent); }
public void SerializeToXml(XmlWriter writer, string elementName) { XmlProxy xmlRoot = new XmlProxy("constraints"); SerializeToXml(xmlRoot); XmlProxySerializer.Instance.Serialize(xmlRoot, writer); }
protected override void SerializeValueToXml(XmlProxy parent) { XmlProxy elementValue = parent.AddChild("value"); elementValue.SetAttr("kind", this.Kind.ToString()); elementValue.SetAttr("name", this.Name); elementValue.SetAttr("type", this.Type); }
// public void SerializeToXml(XmlWriter writer, string propertyName) // { // XmlProxy xmlRoot = new XmlProxy(propertyName); // SerializeToXml(xmlRoot); // XmlProxySerializer.Instance.Serialize(xmlRoot, writer); // } protected override void SerializeValueToXml(XmlProxy parent) { XmlProxy xmlContent = parent.AddChild("content"); xmlContent.SetAttr("default", this.Default); this.Value.SerializeToXml(xmlContent, "value"); }
public void DeserializeFromXml(XmlProxy parent) { if (parent.ElementName == "fields") { this.KeyFields.DeserializeFromXml(parent, "keyFields"); this.IncludedFields.DeserializeFromXml(parent, "includedFields"); } }
public virtual void SerializeToXml(XmlProxy xmlRoot) { xmlRoot.AddAttribute("valueType", ValueType); if (CanSerializeValue()) { SerializeValueToXml(xmlRoot); } }
public void SerializeToXml(XmlWriter writer, string propertyName) { XmlProxy xmlRoot = new XmlProxy(propertyName); xmlRoot.AddAttribute("getter", this.Getter); xmlRoot.AddAttribute("setter", this.Setter); XmlProxySerializer.Instance.Serialize(xmlRoot, writer); }
protected override void InternalSerializeToXml(XmlProxy xmlRoot) { //xmlRoot.AddAttribute("isReference", IsReference); var xmlisReference = xmlRoot.AddChild("isReference"); this.IsReference.SerializeToXml(xmlisReference); xmlRoot.AddAttribute("namespace", this.Namespace); }
protected override void DeserializeValueFromXml(XmlProxy parent) { XmlProxy xmlContent = parent["content"]; this.Default = xmlContent.GetAttr("default", false); this.Value = new ObjectValue(); this.Value.DeserializeFromXml(xmlContent, "value"); }
/// <summary> /// Set child value. /// </summary> /// <param name="ChildElementName">Child element name.</param> /// <param name="ChildElementValue"><see cref="Guid"/> value.</param> public void SetChildValue(string ChildElementName, Guid ChildElementValue) { XmlProxy item = mChilds[ChildElementName]; if (item != null) { item.ElementValue = ChildElementValue.ToString(); } }
public void SerializeToXml(XmlProxy xmlRoot) { foreach (PropertyConstraint constraint in AllConstraints) { XmlProxy xmlConstraint = xmlRoot.AddChild("constraint"); xmlConstraint.AddAttribute("type", constraint.ConstrainType); constraint.SerializeToXml(xmlConstraint); } }
public void DeserializeFromXml(XmlReader reader, string propertyName) { XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader); if (xmlRoot.ElementName == propertyName) { DeserializeFromXml(xmlRoot); } }
public void DeserializeFromXml(XmlReader reader, string propertyName) { XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader); if (xmlRoot.ElementName == propertyName) { this.Getter = (PropertyAccessModifier)xmlRoot.GetAttr("getter", (int)PropertyAccessModifier.Public); this.Setter = (PropertyAccessModifier)xmlRoot.GetAttr("setter", (int)PropertyAccessModifier.Public); } }
/// <summary> /// Get child value. /// </summary> /// <param name="ChildElementName">Child element name.</param> /// <returns> /// Returns child value as <see cref="System.String"/> /// </returns> public string GetChildValue(string ChildElementName) { XmlProxy item = mChilds[ChildElementName]; if ((item != null) && (item.ElementValue != null)) { return(item.ElementValue); } return(string.Empty); }
protected override void InternalDeserializeFromXml(XmlProxy xmlRoot) { //this.IsReference = xmlRoot.GetAttr("isReference", false); var xmlisReference = xmlRoot["isReference"]; this.IsReference = new Defaultable <bool>(); this.IsReference.DeserializeFromXml(xmlisReference); this.Namespace = xmlRoot.GetAttr("namespace"); }
protected override void InternalSerializeToXml(XmlProxy content) { XmlProxy minXml = content.AddChild("min"); this.Min.SerializeToXml(minXml); XmlProxy maxXml = content.AddChild("max"); this.Max.SerializeToXml(maxXml); }
protected override void SerializeValueToXml(XmlProxy parent) { XmlProxy xmlDirection = parent.AddChild("direction"); this.Direction.SerializeToXml(xmlDirection); XmlProxy xmlPosition = parent.AddChild("position"); this.Position.SerializeToXml(xmlPosition); }
protected override void DeserializeValueFromXml(XmlProxy parent) { XmlProxy elementValue = parent["value"]; string kind = elementValue.GetAttr("kind"); this.Kind = (KeyGeneratorKind)Enum.Parse(typeof(KeyGeneratorKind), kind, true); this.Name = elementValue.GetAttr("name"); this.Type = elementValue.GetAttr("type"); }
protected override void InternalDeserializeFromXml(XmlProxy content) { XmlProxy minXml = content.Childs["min"]; XmlProxy maxXml = content.Childs["max"]; this.Min = new ObjectValueInfo(); this.Min.DeserializeFromXml(minXml); this.Max = new ObjectValueInfo(); this.Max.DeserializeFromXml(maxXml); }
protected override void DeserializeValueFromXml(XmlProxy parent) { XmlProxy xmlDirection = parent["direction"]; this.Direction = new Defaultable <KeyDirection>(); this.Direction.DeserializeFromXml(xmlDirection); XmlProxy xmlPosition = parent["position"]; this.Position = new Defaultable <int>(); this.Position.DeserializeFromXml(xmlPosition); }
/// <summary> /// Clones <see cref="XmlProxy"/> object /// </summary> /// <returns>Cloned <see cref="XmlProxy"/> object.</returns> public XmlProxy Clone() { XmlProxy cloned = new XmlProxy(ElementName, ElementValue); cloned.Tag = Tag; cloned.Attributes = Attributes.Clone(); foreach (XmlProxy child in Childs) { cloned.AddChild(child.Clone()); } return(cloned); }
/// <summary> /// Get child value. /// </summary> /// <param name="ChildElementName">Child element name.</param> /// <returns> /// Returns child value as <see cref="System.Guid"/> /// </returns> public Guid GetChildValueGuid(string ChildElementName) { XmlProxy item = mChilds[ChildElementName]; if ((item != null) && (item.ElementValue != null)) { if (item.ElementValue.Length == 0) { return(Guid.Empty); } return(new Guid(item.ElementValue)); } return(Guid.Empty); }
protected override void SerializeValueToXml(XmlProxy parent) { XmlProxy elementValue = parent.AddChild("value"); elementValue.SetAttr("inheritanceSchema", this.InheritanceSchema.ToString()); XmlProxy elementIncludeTypeId = elementValue.AddChild("includeTypeId"); IncludeTypeId.SerializeToXml(elementIncludeTypeId); XmlProxy xmlMappingName = elementValue.AddChild("mappingName"); MappingName.SerializeToXml(xmlMappingName); }