private void OnDeserialized(StreamingContext context)
 {
     // We only need to complete deserialization if we were hooking the deserialization process.  If
     // we have not deserialized an object in the GetRealObject call, then there's nothing more for
     // us to do here.
     if (m_realObject != null)
     {
         // Fire the real object's OnDeserialized method if they registered one.  Since we replaced
         // ourselves as the target of the deserialization, OnDeserialized on the target won't
         // automatically get triggered unless we do it manually.
         SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(m_realObject.GetType());
         cache.InvokeOnDeserialized(m_realObject, context);
         m_realObject = null;
     }
 }
Example #2
0
        // [System.Security.SecurityCritical]  // auto-generated_required
        public void RegisterObject(Object obj)
        {
            // Invoke OnSerializing for this object
            SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            // Check to make sure type has serializing events
            if (cache.HasOnSerializingEvents)
            {
                // Check to see if we have invoked the events on the object
                if (m_objectSeenTable[obj] == null)
                {
                    m_objectSeenTable[obj] = true;
                    // Invoke the events
                    cache.InvokeOnSerializing(obj, m_context);
                    // Register for OnSerialized event
                    AddOnSerialized(obj);
                }
            }
        }
Example #3
0
        private void AddOnSerialized(Object obj)
        {
            SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            m_onSerializedHandler = cache.AddOnSerialized(obj, m_onSerializedHandler);
        }