IEnumerable <XAttribute> IAttributeSerializableAnnotation.Serialize(AnnotationSerializer serializer, XNamespace ns) { if (dataType != null) { yield return(new XAttribute(ns + "type", dataType)); } if (!relevant) { yield return(new XAttribute(ns + "relevant", relevant)); } if (readOnly) { yield return(new XAttribute(ns + "readonly", readOnly)); } if (required) { yield return(new XAttribute(ns + "required", required)); } if (!valid) { yield return(new XAttribute(ns + "valid", valid)); } if (value != null && value != "") { yield return(new XAttribute(ns + "value", value)); } }
void IAttributeSerializableAnnotation.Deserialize(AnnotationSerializer serializer, XNamespace ns, IEnumerable <XAttribute> attributes) { dataType = attributes.Where(i => i.Name == ns + "type").Select(i => XName.Get((string)i)).FirstOrDefault(); relevant = (bool?)attributes.FirstOrDefault(i => i.Name == ns + "relevant") ?? true; readOnly = (bool?)attributes.FirstOrDefault(i => i.Name == ns + "readonly") ?? false; required = (bool?)attributes.FirstOrDefault(i => i.Name == ns + "required") ?? false; valid = (bool?)attributes.FirstOrDefault(i => i.Name == ns + "valid") ?? true; value = (string)attributes.FirstOrDefault(i => i.Name == ns + "value") ?? ""; }
public Repeat( XElement element, RepeatAttributes attributes, Extension <IBindingNode> bindingNode, Extension <IUIBindingNode> uiBindingNode, AnnotationSerializer serializer) : base(element) { Contract.Requires <ArgumentNullException>(element != null); Contract.Requires <ArgumentNullException>(attributes != null); Contract.Requires <ArgumentNullException>(bindingNode != null); Contract.Requires <ArgumentNullException>(uiBindingNode != null); Contract.Requires <ArgumentNullException>(serializer != null); this.serializer = serializer; this.attributes = attributes; this.bindingNode = bindingNode; this.binding = new Lazy <Binding>(() => bindingNode.Value.Binding); this.uiBindingNode = uiBindingNode; this.uiBinding = new Lazy <UIBinding>(() => uiBindingNode.Value.UIBinding); this.state = new Lazy <RepeatState>(() => Element.AnnotationOrCreate <RepeatState>()); this.template = new Lazy <XElement>(() => State.Template); }
XElement ISerializableAnnotation.Serialize(AnnotationSerializer serializer) { return(new XElement("instance", new XElement("xml", serializer.Serialize(document).Root))); }
void ISerializableAnnotation.Deserialize(AnnotationSerializer serializer, XElement element) { document = serializer.Deserialize( new XDocument( element.Element("xml").Elements())); }
XElement ISerializableAnnotation.Serialize(AnnotationSerializer serializer) { return(new XElement("document", new XAttribute("construct-done-once", constructDoneOnce), new XAttribute("failed", failed ? "true" : "false"))); }
void ISerializableAnnotation.Deserialize(AnnotationSerializer serializer, XElement element) { constructDoneOnce = (bool)element.Attribute("construct-done-once"); failed = (bool)element.Attribute("failed"); }
public XmlModelDeserializer(AnnotationSerializer serializer) { Contract.Requires <ArgumentNullException>(serializer != null); this.serializer = serializer; }
public void Deserialize(AnnotationSerializer serializer, XElement element) { }
public XElement Serialize(AnnotationSerializer serializer) { return(new XElement("include-scope")); }