/// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            if (reader.IsEmptyElement && !reader.HasAttributes)
            {
                return;
            }

            var serializer = SerializationFactory.GetXmlSerializer();
            var contextInfo = new XmlSerializationContextInfo(reader, this);

            serializer.Deserialize(this, contextInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            if (reader.IsEmptyElement && !reader.HasAttributes)
            {
                return;
            }

            var contextInfo = new XmlSerializationContextInfo(reader, this);

            var scopeName = SerializationContextHelper.GetSerializationReferenceManagerScopeName();
            using (var scopeManager = ScopeManager<SerializationScope>.GetScopeManager(scopeName, () => new SerializationScope(SerializationFactory.GetXmlSerializer(), SerializationConfiguration)))
            {
                var serializer = scopeManager.ScopeObject.Serializer;
                serializer.Deserialize(this, contextInfo, scopeManager.ScopeObject.Configuration);
            }
        }