Inheritance: XmlSerializationGeneratedCode
Beispiel #1
0
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize6"]/*' />
 // SOAP12: made this internal
 internal void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle)
 {
     try {
         if (tempAssembly == null)
         {
             XmlSerializationWriter writer = CreateWriter();
             writer.Init(xmlWriter, (namespaces == null || namespaces.Count == 0 ? defaultNamespaces : namespaces).NamespaceList, encodingStyle, null);
             try {
                 Serialize(o, writer);
             }
             finally {
                 writer.Dispose();
             }
         }
         else
         {
             tempAssembly.InvokeWriter(methodIndex, xmlWriter, o, (namespaces == null || namespaces.Count == 0 ? defaultNamespaces : namespaces).NamespaceList, encodingStyle);
         }
     }
     catch (Exception e) {
         if (e is TargetInvocationException)
         {
             e = e.InnerException;
         }
         throw new InvalidOperationException(Res.GetString(Res.XmlGenError), e);
     }
     xmlWriter.Flush();
 }
        internal void InvokeWriter(XmlMapping mapping, XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
        {
            XmlSerializationWriter writer = null;

            try {
                encodingStyle = ValidateEncodingStyle(encodingStyle, mapping.Key);
                writer        = Contract.Writer;
                writer.Init(xmlWriter, namespaces, encodingStyle, id, this);
                if (methods[mapping.Key].writeMethod == null)
                {
                    if (writerMethods == null)
                    {
                        writerMethods = Contract.WriteMethods;
                    }
                    string methodName = (string)writerMethods[mapping.Key];
                    if (methodName == null)
                    {
                        throw new InvalidOperationException(Res.GetString(Res.XmlNotSerializable, mapping.Accessor.Name));
                    }
                    methods[mapping.Key].writeMethod = GetMethodFromType(writer.GetType(), methodName, pregeneratedAssmbly ? assembly : null);
                }
                methods[mapping.Key].writeMethod.Invoke(writer, new object[] { o });
            }
            catch (SecurityException e) {
                throw new InvalidOperationException(Res.GetString(Res.XmlNoPartialTrust), e);
            }
            finally {
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
        }
Beispiel #3
0
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize6"]/*' />
        public void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
        {
            try
            {
                if (_primitiveType != null)
                {
                    if (encodingStyle != null && encodingStyle.Length > 0)
                    {
                        throw new InvalidOperationException(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle));
                    }
                    SerializePrimitive(xmlWriter, o, namespaces);
                }
#if !NET_NATIVE
                else if (_tempAssembly == null || _typedSerializer)
                {
                    XmlSerializationWriter writer = CreateWriter();
                    writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id, _tempAssembly);
                    try
                    {
                        Serialize(o, writer);
                    }
                    finally
                    {
                        writer.Dispose();
                    }
                }
                else
                {
                    _tempAssembly.InvokeWriter(_mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                }
#else
                else
                {
                    if (this.innerSerializer == null)
                    {
                        throw new InvalidOperationException(SR.Format(SR.Xml_MissingSerializationCodeException, this.rootType, typeof(XmlSerializer).Name));
                    }

                    if (!string.IsNullOrEmpty(this.DefaultNamespace))
                    {
                        this.innerSerializer.DefaultNamespace = this.DefaultNamespace;
                    }

                    XmlSerializationWriter writer = this.innerSerializer.CreateWriter();
                    writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                    try
                    {
                        this.innerSerializer.Serialize(o, writer);
                    }
                    finally
                    {
                        writer.Dispose();
                    }
                }
#endif
            }
 internal void Write_dateTime(object o)
 {
     base.WriteStartDocument();
     if (o == null)
     {
         base.WriteEmptyTag("dateTime", "");
     }
     else
     {
         base.WriteElementStringRaw("dateTime", "", XmlSerializationWriter.FromDateTime((DateTime)o));
     }
 }
 internal void Write_char(object o)
 {
     base.WriteStartDocument();
     if (o == null)
     {
         base.WriteEmptyTag("char", "");
     }
     else
     {
         base.WriteElementString("char", "", XmlSerializationWriter.FromChar((char)o));
     }
 }
 internal void Write_base64Binary(object o)
 {
     base.WriteStartDocument();
     if (o == null)
     {
         base.WriteNullTagLiteral("base64Binary", "");
     }
     else
     {
         base.TopLevelElement();
         base.WriteNullableStringLiteralRaw("base64Binary", "", XmlSerializationWriter.FromByteArrayBase64((byte[])o));
     }
 }
Beispiel #7
0
        protected virtual void Serialize(object o, XmlSerializationWriter writer)
        {
            if (customSerializer)
            {
                // Must be implemented in derived class
                throw new NotImplementedException();
            }

            if (writer is XmlSerializationWriterInterpreter)
            {
                ((XmlSerializationWriterInterpreter)writer).WriteRoot(o);
            }
            else
            {
                serializerData.WriterMethod.Invoke(writer, new object[] { o });
            }
        }
        public void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
        {
            try
            {
                if (this.primitiveType != null)
                {
                    if ((encodingStyle != null) && (encodingStyle.Length > 0))
                    {
                        throw new InvalidOperationException(Res.GetString("XmlInvalidEncodingNotEncoded1", new object[] { encodingStyle }));
                    }
                    this.SerializePrimitive(xmlWriter, o, namespaces);
                }
                else
                {
                    if ((this.tempAssembly == null) || this.typedSerializer)
                    {
                        XmlSerializationWriter writer = this.CreateWriter();
                        writer.Init(xmlWriter, ((namespaces == null) || (namespaces.Count == 0)) ? DefaultNamespaces : namespaces, encodingStyle, id, this.tempAssembly);
                        try
                        {
                            this.Serialize(o, writer);
                            goto Label_00F7;
                        }
                        finally
                        {
                            writer.Dispose();
                        }
                    }
                    this.tempAssembly.InvokeWriter(this.mapping, xmlWriter, o, ((namespaces == null) || (namespaces.Count == 0)) ? DefaultNamespaces : namespaces, encodingStyle, id);
                }
            }
            catch (Exception innerException)
            {
                if (((innerException is ThreadAbortException) || (innerException is StackOverflowException)) || (innerException is OutOfMemoryException))
                {
                    throw;
                }
                if (innerException is TargetInvocationException)
                {
                    innerException = innerException.InnerException;
                }
                throw new InvalidOperationException(Res.GetString("XmlGenError"), innerException);
            }
Label_00F7:
            xmlWriter.Flush();
        }
Beispiel #9
0
        public void InvokeWriter(int methodIndex, XmlWriter xmlWriter, object o, ArrayList namespaces)
        {
            if (!allAssembliesAllowPartialTrust)
            {
                new PermissionSet(PermissionState.Unrestricted).Demand();
            }
            XmlSerializationWriter writer = (XmlSerializationWriter)Activator.CreateInstance(writerType);

            writer.Init(xmlWriter, namespaces);
            ResolveEventHandler resolver = new ResolveEventHandler(this.OnAssemblyResolve);

            assemblyResolveThread = Thread.CurrentThread.GetHashCode();
            AppDomain.CurrentDomain.AssemblyResolve += resolver;
            methods[methodIndex].writeMethod.Invoke(writer, new object[] { o });
            AppDomain.CurrentDomain.AssemblyResolve -= resolver;
            assemblyResolveThread = 0;
        }
Beispiel #10
0
 public void Serialize(XmlWriter xmlWriter, object?o, XmlSerializerNamespaces?namespaces, string?encodingStyle, string?id)
 {
     try
     {
         if (_primitiveType != null)
         {
             if (encodingStyle != null && encodingStyle.Length > 0)
             {
                 throw new InvalidOperationException(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle));
             }
             SerializePrimitive(xmlWriter, o, namespaces);
         }
         else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
         {
             SerializeUsingReflection(xmlWriter, o, namespaces, encodingStyle, id);
         }
         else if (_tempAssembly == null || _typedSerializer)
         {
             // The contion for the block is never true, thus the block is never hit.
             XmlSerializationWriter writer = CreateWriter();
             writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id, _tempAssembly);
             try
             {
                 Serialize(o, writer);
             }
             finally
             {
                 writer.Dispose();
             }
         }
         else
         {
             _tempAssembly.InvokeWriter(_mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
         }
     }
     catch (Exception?e)
     {
         if (e is TargetInvocationException)
         {
             e = e.InnerException;
         }
         throw new InvalidOperationException(SR.XmlGenError, e);
     }
     xmlWriter.Flush();
 }
Beispiel #11
0
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize6"]/*' />
        internal void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
        {
#if FEATURE_LEGACYNETCF
            if (_legacyNetCFSerializer != null)
            {
                _legacyNetCFSerializer.Serialize(xmlWriter, o, namespaces, encodingStyle);
                return;
            }
#endif

            try
            {
                if (_primitiveType != null)
                {
                    SerializePrimitive(xmlWriter, o, namespaces);
                }
                else if (_tempAssembly == null || _typedSerializer)
                {
                    XmlSerializationWriter writer = CreateWriter();
                    writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id, _tempAssembly);
                    try
                    {
                        Serialize(o, writer);
                    }
                    finally
                    {
                        writer.Dispose();
                    }
                }
                else
                {
                    _tempAssembly.InvokeWriter(_mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                }
            }
            catch (Exception e)
            {
                if (e is TargetInvocationException)
                {
                    e = e.InnerException;
                }
                throw new InvalidOperationException(SR.XmlGenError, e);
            }
            xmlWriter.Flush();
        }
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize6"]/*' />
 public void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
 {
     try {
         if (primitiveType != null)
         {
             if (encodingStyle != null && encodingStyle.Length > 0)
             {
                 throw new InvalidOperationException(Res.GetString(Res.XmlInvalidEncodingNotEncoded1, encodingStyle));
             }
             SerializePrimitive(xmlWriter, o, namespaces);
         }
         else if (tempAssembly == null || typedSerializer)
         {
             XmlSerializationWriter writer = CreateWriter();
             writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id, tempAssembly);
             try {
                 Serialize(o, writer);
             }
             finally {
                 writer.Dispose();
             }
         }
         else
         {
             tempAssembly.InvokeWriter(mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
         }
     }
     catch (Exception e) {
         if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
         {
             throw;
         }
         if (e is TargetInvocationException)
         {
             e = e.InnerException;
         }
         throw new InvalidOperationException(Res.GetString(Res.XmlGenError), e);
     }
     catch {
         throw new InvalidOperationException(Res.GetString(Res.XmlGenError), null);
     }
     xmlWriter.Flush();
 }
        internal void InvokeWriter(int methodIndex, XmlWriter xmlWriter, object o, ArrayList namespaces, string encodingStyle)
        {
            XmlSerializationWriter writer = null;

            try {
                encodingStyle = ValidateEncodingStyle(encodingStyle, methodIndex);
                writer        = (XmlSerializationWriter)Activator.CreateInstance(writerType);
                writer.Init(xmlWriter, namespaces, encodingStyle, this);

                methods[methodIndex].writeMethod.Invoke(writer, new object[] { o });
            }
            catch (SecurityException e) {
                throw new InvalidOperationException(Res.GetString(Res.XmlNoPartialTrust), e);
            }
            finally {
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
        }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write273_VirtualItemNameListFilter(objectToSerialize);
 }
Beispiel #15
0
 protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer)
 {
     ((WebReferenceOptionsWriter)writer).WriteRoot_WebReferenceOptions(obj);
 }
Beispiel #16
0
 ///<internalonly/>
 protected virtual void Serialize(object o, XmlSerializationWriter writer) { throw new PlatformNotSupportedException(); }
Beispiel #17
0
 // Exceptions:
 //   System.NotImplementedException:
 //     Any attempt is made to access the method when the method is not overridden
 //     in a descendant class.
 /// <summary>
 /// Serializes the specified System.Object and writes the XML document to a file
 /// using the specified System.Xml.Serialization.XmlSerializationWriter.
 /// </summary>
 /// <param name="o">The System.Object to serialize.</param>
 /// <param name="writer">
 /// The System.Xml.Serialization.XmlSerializationWriter used to write the XML
 /// document.
 /// </param>
 protected virtual void Serialize(object o, XmlSerializationWriter writer)
 {
     throw new NotImplementedException("Please use the DataContractSerializer instead of the XmlSerializer.");
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write254_ContentDefaultParamStruct(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write336_FormPlacement(objectToSerialize);
 }
Beispiel #20
0
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize7"]/*' />
 ///<internalonly/>
 protected virtual void Serialize(object o, XmlSerializationWriter writer)
 {
     throw new PlatformNotSupportedException();
 }
		protected override void Serialize (object o, XmlSerializationWriter writer)
		{
			XmlSchemaSerializationWriter w = writer as XmlSchemaSerializationWriter;
			w.WriteRoot_XmlSchema ((XmlSchema) o);
		}
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write314_SimpleEncrypt(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write81_WildcardablePropertyQuery(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write317_VistaProgressBarRenderer(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write330_SolidSizeUnit(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write292_RatingTypeConverter(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write267_ItemDateTimePart(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write213_ConfigurableSettingsProvider(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write242_PK_CAPS(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write258_AggregatedFilterCondition(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write307_DelayedExtractMode(objectToSerialize);
 }
 protected override void Serialize(object o, System.Xml.Serialization.XmlSerializationWriter writer)
 {
     base.Serialize(o, writer);
 }
Beispiel #33
0
			protected override void Serialize (object o, XmlSerializationWriter writer)
			{
				ServiceDescriptionWriterBase xsWriter = writer as ServiceDescriptionWriterBase;
				xsWriter.WriteRoot_ServiceDescription (o);
			}
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write246_WcxErrors(objectToSerialize);
 }
Beispiel #35
0
		protected virtual void Serialize (object o, XmlSerializationWriter writer)
		{
			if (customSerializer)
				// Must be implemented in derived class
				throw new NotImplementedException ();
				
			if (writer is XmlSerializationWriterInterpreter)
				((XmlSerializationWriterInterpreter)writer).WriteRoot (o);
			else {
				try {
					serializerData.WriterMethod.Invoke (writer, new object[] {o});
				} catch (TargetInvocationException ex) {
					throw ex.InnerException;
				}
			}
		}
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize7"]/*' />
 ///<internalonly/>
 protected virtual void Serialize(object o, XmlSerializationWriter writer)
 {
     throw new NotImplementedException();
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write237_ProcessItemEventArgs(objectToSerialize);
 }
Beispiel #38
0
 protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer)
 {
     ((GeneratedWriter)writer).WriteRoot_InventoryCollection(obj);
 }
 protected override void Serialize(Object objectToSerialize, XmlSerializationWriter writer) {
     ((DiscoveryDocumentSerializationWriter)writer).Write10_discovery(objectToSerialize);
 }
Beispiel #40
0
        public void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
        {
            try
            {
                if (_primitiveType != null)
                {
                    if (encodingStyle != null && encodingStyle.Length > 0)
                    {
                        throw new InvalidOperationException(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle));
                    }
                    SerializePrimitive(xmlWriter, o, namespaces);
                }
                else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
                {
                    SerializeUsingReflection(xmlWriter, o, namespaces, encodingStyle, id);
                }
#if !FEATURE_SERIALIZATION_UAPAOT
                else if (_tempAssembly == null || _typedSerializer)
                {
                    // The contion for the block is never true, thus the block is never hit.
                    XmlSerializationWriter writer = CreateWriter();
                    writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id, _tempAssembly);
                    try
                    {
                        Serialize(o, writer);
                    }
                    finally
                    {
                        writer.Dispose();
                    }
                }
                else
                {
                    _tempAssembly.InvokeWriter(_mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                }
#else
                else
                {
                    if (this.innerSerializer != null)
                    {
                        if (!string.IsNullOrEmpty(this.DefaultNamespace))
                        {
                            this.innerSerializer.DefaultNamespace = this.DefaultNamespace;
                        }

                        XmlSerializationWriter writer = this.innerSerializer.CreateWriter();
                        writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                        try
                        {
                            this.innerSerializer.Serialize(o, writer);
                        }
                        finally
                        {
                            writer.Dispose();
                        }
                    }
                    else if (ReflectionMethodEnabled)
                    {
                        SerializeUsingReflection(xmlWriter, o, namespaces, encodingStyle, id);
                    }
                    else
                    {
                        throw new InvalidOperationException(SR.Format(SR.Xml_MissingSerializationCodeException, this._rootType, typeof(XmlSerializer).Name));
                    }
                }
#endif
            }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write223_CustomActionLink(objectToSerialize);
 }
Beispiel #42
0
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Serialize6"]/*' />
        public void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)
        {
            try
            {
                if (_primitiveType != null)
                {
                    if (encodingStyle != null && encodingStyle.Length > 0)
                    {
                        throw new InvalidOperationException(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle));
                    }
                    SerializePrimitive(xmlWriter, o, namespaces);
                }
#if !NET_NATIVE
                else if (Mode == SerializationMode.ReflectionOnly)
                {
                    XmlMapping mapping;
                    if (_mapping != null && _mapping.GenerateSerializer)
                    {
                        mapping = _mapping;
                    }
                    else
                    {
                        XmlReflectionImporter importer = new XmlReflectionImporter(DefaultNamespace);
                        mapping = importer.ImportTypeMapping(rootType, null, DefaultNamespace);
                    }

                    var writer = new ReflectionXmlSerializationWriter(mapping, xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                    writer.WriteObject(o);
                }
                else if (_tempAssembly == null || _typedSerializer)
                {
                    // The contion for the block is never true, thus the block is never hit.
                    XmlSerializationWriter writer = CreateWriter();
                    writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id, _tempAssembly);
                    try
                    {
                        Serialize(o, writer);
                    }
                    finally
                    {
                        writer.Dispose();
                    }
                }
                else
                {
                    _tempAssembly.InvokeWriter(_mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                }
#else
                else
                {
                    if (this.innerSerializer != null)
                    {
                        if (!string.IsNullOrEmpty(this.DefaultNamespace))
                        {
                            this.innerSerializer.DefaultNamespace = this.DefaultNamespace;
                        }

                        XmlSerializationWriter writer = this.innerSerializer.CreateWriter();
                        writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                        try
                        {
                            this.innerSerializer.Serialize(o, writer);
                        }
                        finally
                        {
                            writer.Dispose();
                        }
                    }
                    else if (ReflectionMethodEnabled)
                    {
                        XmlMapping mapping;
                        if (_mapping != null && _mapping.GenerateSerializer)
                        {
                            mapping = _mapping;
                        }
                        else
                        {
                            XmlReflectionImporter importer = new XmlReflectionImporter(DefaultNamespace);
                            mapping = importer.ImportTypeMapping(rootType, null, DefaultNamespace);
                        }

                        var writer = new ReflectionXmlSerializationWriter(mapping, xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id);
                        writer.WriteObject(o);
                    }
                    else
                    {
                        throw new InvalidOperationException(SR.Format(SR.Xml_MissingSerializationCodeException, this.rootType, typeof(XmlSerializer).Name));
                    }
                }
#endif
            }
Beispiel #43
0
 protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer)
 {
     ((Soap12FaultWriter)writer).WriteRoot_Soap12Fault(obj);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write315_ProgressRenderMode(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write278_HashPropertyProvider(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write74_StaticMethodParameterMetadata(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write252_ShellFileSystemCreator(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write361_CopyWorkerOptions(objectToSerialize);
 }
 protected override void Serialize(Object objectToSerialize, XmlSerializationWriter writer) {
     ((ServiceDescriptionSerializationWriter)writer).Write125_definitions(objectToSerialize);
 }
 protected override void Serialize(System.Object objectToSerialize, XmlSerializationWriter writer) {
     ((WebReferenceOptionsSerializationWriter)writer).Write5_webReferenceOptions(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write241_PK_OPERATION(objectToSerialize);
 }
 protected override void Serialize(object objectToSerialize, XmlSerializationWriter writer)
 {
     ((XmlSerializationWriter1) writer).Write337_ArgumentKey(objectToSerialize);
 }