Esempio n. 1
0
        private static void CustomReadPropertiesFromElements(SerializationContext serializationContext, Interface element, XmlReader reader)
        {
            while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
            {
                switch (reader.LocalName)
                {
                case "inheritsIEntity":
                    if (reader.IsEmptyElement)
                    {                                        // No serialized value, must be default one.
                        SerializationUtilities.Skip(reader); // Skip this tag.
                    }
                    else
                    {
                        string strValue = DONetEntityModelDesignerSerializationHelper.Instance.ReadElementContentAsString(serializationContext, element, reader);
                        InheritsIEntityMode value;
                        if (Enum.TryParse(strValue, true, out value))
                        {
                            element.InheritsIEntity = value;
                        }
                        else
                        {       // Invalid property value, ignored.
                            EntityModelDesignerSerializationBehaviorSerializationMessages.IgnoredPropertyValue(serializationContext, reader, "inheritsIEntity", typeof(InheritsIEntityMode), strValue);
                        }

                        SerializationUtilities.SkipToNextElement(reader);
                    }
                    break;

                default:
                    return;  // Don't know this element.
                }
            }
        }
Esempio n. 2
0
 private static void CustomWritePropertiesAsElements(SerializationContext context, Interface element, XmlWriter writer)
 {
     if (!context.Result.Failed)
     {
         var value = element.InheritsIEntity.ToString();
         DONetEntityModelDesignerSerializationHelper.Instance.WriteElementString(context, element, writer, "inheritsIEntity", value);
     }
 }