Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Runtime / Serialization / SerializationObjectManager.cs / 1 / SerializationObjectManager.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SerializationObjectManager ** ** ** Purpose: Encapsulates serialization time management, mainly invoking serialization events ** ** ============================================================*/ namespace System.Runtime.Serialization { using System; using System.Collections; using System.Runtime.Serialization; using System.Security.Permissions; public sealed class SerializationObjectManager{ private Hashtable m_objectSeenTable = new Hashtable(); // Table to keep track of objects [OnSerializing] has been called on private SerializationEventHandler m_onSerializedHandler; private StreamingContext m_context; public SerializationObjectManager(StreamingContext context) { m_context = context; m_objectSeenTable = new Hashtable(); } [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)] 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); } } } public void RaiseOnSerializedEvent() { if (m_onSerializedHandler != null) { m_onSerializedHandler(m_context); } } private void AddOnSerialized(Object obj) { SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()); m_onSerializedHandler = cache.AddOnSerialized(obj, m_onSerializedHandler); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataColumn.cs
- AnnotationComponentManager.cs
- OdbcRowUpdatingEvent.cs
- IndexedEnumerable.cs
- ProtectedConfiguration.cs
- ToolboxItem.cs
- RequestCachingSection.cs
- XpsInterleavingPolicy.cs
- MetafileHeader.cs
- SqlGatherConsumedAliases.cs
- SafeBitVector32.cs
- ConstraintCollection.cs
- QilUnary.cs
- IPAddress.cs
- Evidence.cs
- LabelEditEvent.cs
- XXXOnTypeBuilderInstantiation.cs
- MemoryMappedViewStream.cs
- SimpleRecyclingCache.cs
- InputMethodStateChangeEventArgs.cs
- MetadataPropertyAttribute.cs
- SystemColors.cs
- TextBox.cs
- CombinedGeometry.cs
- WebPartsPersonalizationAuthorization.cs
- MouseGestureConverter.cs
- BitmapSourceSafeMILHandle.cs
- RawMouseInputReport.cs
- XmlSchemaSet.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- AuthorizationSection.cs
- PersonalizableTypeEntry.cs
- GraphicsPathIterator.cs
- XmlSchemaCompilationSettings.cs
- ContravarianceAdapter.cs
- Comparer.cs
- MeasureItemEvent.cs
- InstanceCreationEditor.cs
- HitTestParameters.cs
- XmlSigningNodeWriter.cs
- SemanticKeyElement.cs
- ButtonPopupAdapter.cs
- ModelItemCollection.cs
- BufferBuilder.cs
- SQLDoubleStorage.cs
- XmlIlGenerator.cs
- JapaneseCalendar.cs
- DateTimeFormatInfo.cs
- DrawingVisual.cs
- ThreadExceptionEvent.cs
- TranslateTransform3D.cs
- SystemFonts.cs
- DetailsViewRowCollection.cs
- HighlightOverlayGlyph.cs
- DesignerTransactionCloseEvent.cs
- VirtualizedItemPattern.cs
- CodeGen.cs
- TextEffect.cs
- IWorkflowDebuggerService.cs
- TextLine.cs
- TextSerializer.cs
- CheckBoxRenderer.cs
- Tuple.cs
- Lease.cs
- XmlLanguageConverter.cs
- SelectorAutomationPeer.cs
- UserControlParser.cs
- TraceHandler.cs
- XmlObjectSerializerReadContext.cs
- XMLUtil.cs
- StylusPointPropertyUnit.cs
- IPPacketInformation.cs
- SqlDesignerDataSourceView.cs
- Int64Storage.cs
- DataGridViewColumnStateChangedEventArgs.cs
- VisualBasicExpressionConverter.cs
- PolyBezierSegment.cs
- BindingElement.cs
- AppSettingsSection.cs
- QueryContinueDragEvent.cs
- XPathArrayIterator.cs
- RepeatBehaviorConverter.cs
- SmiMetaData.cs
- RawStylusInputCustomData.cs
- TreeView.cs
- SemanticBasicElement.cs
- LineBreakRecord.cs
- SimpleLine.cs
- TreeBuilder.cs
- NativeMethods.cs
- Divide.cs
- WebPageTraceListener.cs
- ErasingStroke.cs
- Identity.cs
- TypeDependencyAttribute.cs
- XamlWriter.cs
- DesignerDataRelationship.cs
- TableAutomationPeer.cs
- ErrorWrapper.cs
- CommandDevice.cs