Exemple #1
0
 internal override void WriteArraySize(XmlWriterDelegator xmlWriter, int size)
 {
     if (preserveObjectReferences && size > -1)
     {
         xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.ArraySizeLocalName, DictionaryGlobals.SerializationNamespace, size);
     }
 }
Exemple #2
0
 internal override bool OnHandleReference(XmlWriterDelegator xmlWriter, object obj, bool canContainCyclicReference)
 {
     if (preserveObjectReferences && !this.IsGetOnlyCollection)
     {
         bool isNew    = true;
         int  objectId = SerializedObjects.GetId(obj, ref isNew);
         if (isNew)
         {
             xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.IdLocalName, DictionaryGlobals.SerializationNamespace, objectId);
         }
         else
         {
             xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.RefLocalName, DictionaryGlobals.SerializationNamespace, objectId);
             xmlWriter.WriteAttributeBool(Globals.XsiPrefix, DictionaryGlobals.XsiNilLocalName, DictionaryGlobals.SchemaInstanceNamespace, true);
         }
         return(!isNew);
     }
     return(base.OnHandleReference(xmlWriter, obj, canContainCyclicReference));
 }
        internal override bool OnHandleReference(XmlWriterDelegator xmlWriter, object obj, bool canContainCyclicReference)
        {
            if (!base.preserveObjectReferences || this.IsGetOnlyCollection)
            {
                return(base.OnHandleReference(xmlWriter, obj, canContainCyclicReference));
            }
            bool newId = true;
            int  id    = base.SerializedObjects.GetId(obj, ref newId);

            if (newId)
            {
                xmlWriter.WriteAttributeInt("z", DictionaryGlobals.IdLocalName, DictionaryGlobals.SerializationNamespace, id);
            }
            else
            {
                xmlWriter.WriteAttributeInt("z", DictionaryGlobals.RefLocalName, DictionaryGlobals.SerializationNamespace, id);
                xmlWriter.WriteAttributeBool("i", DictionaryGlobals.XsiNilLocalName, DictionaryGlobals.SchemaInstanceNamespace, true);
            }
            return(!newId);
        }
 internal override void WriteArraySize(XmlWriterDelegator xmlWriter, int size)
 {
     if (preserveObjectReferences && size > -1)
         xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.ArraySizeLocalName, DictionaryGlobals.SerializationNamespace, size);
 }
 internal override bool OnHandleReference(XmlWriterDelegator xmlWriter, object obj, bool canContainCyclicReference)
 {
     if (preserveObjectReferences && !this.IsGetOnlyCollection)
     {
         bool isNew = true;
         int objectId = SerializedObjects.GetId(obj, ref isNew);
         if (isNew)
             xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.IdLocalName, DictionaryGlobals.SerializationNamespace, objectId);
         else
         {
             xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.RefLocalName, DictionaryGlobals.SerializationNamespace, objectId);
             xmlWriter.WriteAttributeBool(Globals.XsiPrefix, DictionaryGlobals.XsiNilLocalName, DictionaryGlobals.SchemaInstanceNamespace, true);
         }
         return !isNew;
     }
     return base.OnHandleReference(xmlWriter, obj, canContainCyclicReference);
 }