Ejemplo n.º 1
0
        //todo: profile the performance of my method vs the .net method

        private void ProcessXmlAttribute(object obj, XmlMapping mapping, XElement elm)
        {
            var value = mapping.GetSingleXAttributeAttributeValue(elm);

            value = NullifyMissingValue(value);
            var finalValue = GetValue(value, mapping.PropertyCache, value?.Value, elm);

            mapping.PropertyCache.SetValue(obj, finalValue);
        }
Ejemplo n.º 2
0
        //todo: profile the performance of my method vs the .net method

        private void ProcessXmlAttribute(object obj, XmlMapping mapping, XElement elm)
        {
            var value = mapping.GetSingleXAttributeAttributeValue(elm);

            try
            {
                value = NullifyMissingValue(value);
                var finalValue = GetValue(value, mapping.PropertyCache, value?.Value, elm);

                mapping.PropertyCache.SetValue(obj, finalValue);
            }
            catch (Exception ex) when(!(ex is XmlDeserializationException))
            {
                throw new XmlDeserializationException(mapping.PropertyCache.Property.PropertyType.GetUnderlyingType(), XmlAttributeExceptionNode(value), ex);
            }
        }