Ejemplo n.º 1
0
        public static void Serialize(KSoft.IO.XmlElementStream s, FA mode, BXmlSerializerInterface xsi,
                                     Collections.BTypeNames list, BListXmlParams @params, bool forceNoRootElementStreaming = false)
        {
            Contract.Requires(s != null);
            Contract.Requires(xsi != null);
            Contract.Requires(list != null);
            Contract.Requires(@params != null);

            if (forceNoRootElementStreaming)
            {
                @params.SetForceNoRootElementStreaming(true);
            }
            using (var xs =
#if NO_TLS_STREAMING
                       new BTypeNamesXmlSerializer(@params, list)
#else
                       BDatabaseXmlSerializerBase.sBTypeNamesXmlSerializer.Value.Reset(@params, list)
#endif
                   )
            {
                xs.StreamXml(s, mode, xsi);
            }
            if (forceNoRootElementStreaming)
            {
                @params.SetForceNoRootElementStreaming(false);
            }
        }
        public static void Serialize <T>(KSoft.IO.XmlElementStream s, FA mode, BXmlSerializerInterface xsi,
                                         Collections.BListAutoId <T> list, BListXmlParams @params, bool forceNoRootElementStreaming = false)
            where T : class, Collections.IListAutoIdObject, new()
        {
            Contract.Requires(s != null);
            Contract.Requires(xsi != null);
            Contract.Requires(list != null);
            Contract.Requires(@params != null);

            if (forceNoRootElementStreaming)
            {
                @params.SetForceNoRootElementStreaming(true);
            }
            using (var xs = CreateXmlSerializer(list, @params))
            {
                xs.StreamXml(s, mode, xsi);
            }
            if (forceNoRootElementStreaming)
            {
                @params.SetForceNoRootElementStreaming(false);
            }
        }