Example #1
0
 private object _parseScalar(BplProperty property, IBplXmlConverter converter, XObject node) {
    if (property.IsWeakAssociation) {
       var idscope = property.ReferencedClass.IdentityScope;
       if (node is XAttribute) {
          return BplIdentity.Get(((XAttribute)node).Value, idscope);
       } else if (node is XElement) {
          return BplIdentity.Get(((XElement)node).Value, idscope);
       }
    } else {
       if (node is XAttribute) {
          return converter.Parse(((XAttribute)node).Value);
       } else if (node is XElement) {
          return converter.Parse((XElement)node);
       }
    }
    throw new InvalidOperationException();
 }
Example #2
0
 private bool _serializeAsElement(IBplXmlConverter converter) {
    if (!(converter is BplConverter)) {
       return false;
    }
    switch (PropertySyntax) {
       case XmlPropertySyntax.Attribute:
          return false;
       case XmlPropertySyntax.Element:
          return true;
       case XmlPropertySyntax.Default:
       default:
          return converter.XmlPropertySyntax == XmlPropertySyntax.Element;
    }
 }