Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / Serialization / SerializationObjectManager.cs / 1305376 / 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(); } [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); } } } 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. // // ==--== /*============================================================ ** ** 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(); } [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); } } } 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CallSiteBinder.cs
- QueryComponents.cs
- ISFClipboardData.cs
- ListViewItemEventArgs.cs
- DataServicePagingProviderWrapper.cs
- DataGridTextBoxColumn.cs
- Permission.cs
- ResourceCodeDomSerializer.cs
- ASCIIEncoding.cs
- TdsParser.cs
- BufferedGraphicsManager.cs
- ComponentCommands.cs
- XmlNamespaceMapping.cs
- DataStreams.cs
- ExtractedStateEntry.cs
- AutomationPropertyInfo.cs
- StringSorter.cs
- ResXResourceSet.cs
- WsatConfiguration.cs
- GeneralTransform3DCollection.cs
- CustomPopupPlacement.cs
- OptimalTextSource.cs
- MetadataLocation.cs
- RegexMatchCollection.cs
- XDRSchema.cs
- DataSetMappper.cs
- ThicknessAnimationUsingKeyFrames.cs
- CriticalHandle.cs
- TripleDESCryptoServiceProvider.cs
- EditBehavior.cs
- MultipleViewProviderWrapper.cs
- Padding.cs
- SecurityAttributeGenerationHelper.cs
- SerialStream.cs
- ValuePattern.cs
- DefaultMemberAttribute.cs
- ViewStateException.cs
- WorkflowService.cs
- RequestTimeoutManager.cs
- CodeDirectoryCompiler.cs
- LineBreakRecord.cs
- PriorityChain.cs
- DataAdapter.cs
- DataStorage.cs
- BinaryExpression.cs
- WebPartConnectionsCancelEventArgs.cs
- XmlProcessingInstruction.cs
- ModelTreeEnumerator.cs
- Pair.cs
- BitmapVisualManager.cs
- DbConnectionInternal.cs
- DataRelationPropertyDescriptor.cs
- CodeConditionStatement.cs
- PrinterUnitConvert.cs
- FloaterParagraph.cs
- LookupBindingPropertiesAttribute.cs
- BoundConstants.cs
- ImageAnimator.cs
- ReadOnlyDataSourceView.cs
- ScriptReferenceEventArgs.cs
- BeginStoryboard.cs
- FlowDocumentFormatter.cs
- FontStyles.cs
- ClipboardProcessor.cs
- _StreamFramer.cs
- ReadOnlyDictionary.cs
- BatchServiceHost.cs
- MSAAWinEventWrap.cs
- DataServiceEntityAttribute.cs
- NameSpaceExtractor.cs
- AsyncContentLoadedEventArgs.cs
- EntityDataSourceReferenceGroup.cs
- ExtendedPropertyCollection.cs
- RuntimeArgumentHandle.cs
- Transform.cs
- HttpServerUtilityWrapper.cs
- StreamAsIStream.cs
- MembershipPasswordException.cs
- XmlSchemaComplexType.cs
- RuntimeConfigLKG.cs
- TextTreeUndoUnit.cs
- SwitchExpression.cs
- FixedSchema.cs
- ProcessRequestArgs.cs
- Dynamic.cs
- ArrayMergeHelper.cs
- PointCollectionValueSerializer.cs
- RequestTimeoutManager.cs
- FormatterServicesNoSerializableCheck.cs
- PropertyDescriptorGridEntry.cs
- XPathDocumentIterator.cs
- SafeHandles.cs
- SystemIPInterfaceProperties.cs
- TrustExchangeException.cs
- InheritanceUI.cs
- SyndicationPerson.cs
- DataGridPagerStyle.cs
- Point.cs
- AuthorizationRuleCollection.cs
- UrlUtility.cs