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
- MetroSerializationManager.cs
- ActivityCodeDomSerializationManager.cs
- LinqDataSourceDisposeEventArgs.cs
- XmlEncodedRawTextWriter.cs
- WindowsFont.cs
- OracleParameterBinding.cs
- PolicyManager.cs
- IPCCacheManager.cs
- LineSegment.cs
- SoapParser.cs
- SHA1Managed.cs
- ExceptionHandler.cs
- Point3DCollection.cs
- AspNetSynchronizationContext.cs
- ListQueryResults.cs
- FunctionImportMapping.cs
- WizardSideBarListControlItem.cs
- X509Chain.cs
- ControlTemplate.cs
- BitmapFrameEncode.cs
- Splitter.cs
- selecteditemcollection.cs
- EntityClientCacheEntry.cs
- ErrorLog.cs
- PictureBox.cs
- WebPartUserCapability.cs
- Thread.cs
- StagingAreaInputItem.cs
- SqlParameterizer.cs
- MonthChangedEventArgs.cs
- MultipartContentParser.cs
- CommandBindingCollection.cs
- TableFieldsEditor.cs
- HMACSHA1.cs
- XmlAttributeAttribute.cs
- Visual3D.cs
- HwndAppCommandInputProvider.cs
- ScriptResourceAttribute.cs
- SystemIPv6InterfaceProperties.cs
- DataGridCaption.cs
- SoapInteropTypes.cs
- Int64AnimationUsingKeyFrames.cs
- ScrollItemProviderWrapper.cs
- ControlEvent.cs
- GuidConverter.cs
- ContextBase.cs
- Bits.cs
- FormClosedEvent.cs
- LineGeometry.cs
- Int64AnimationUsingKeyFrames.cs
- CoTaskMemUnicodeSafeHandle.cs
- FormViewInsertedEventArgs.cs
- AgileSafeNativeMemoryHandle.cs
- TableRow.cs
- TransactionContext.cs
- SerializationStore.cs
- ToolStripEditorManager.cs
- ObjectMemberMapping.cs
- GroupBox.cs
- ClosableStream.cs
- Package.cs
- ClientSettingsSection.cs
- ResourceExpressionBuilder.cs
- MetadataResolver.cs
- FunctionNode.cs
- ScriptingAuthenticationServiceSection.cs
- ValueQuery.cs
- SoapRpcServiceAttribute.cs
- SerializationFieldInfo.cs
- InertiaRotationBehavior.cs
- ThemeableAttribute.cs
- EntityContainerEmitter.cs
- RuntimeConfigurationRecord.cs
- _NestedMultipleAsyncResult.cs
- SmtpAuthenticationManager.cs
- JsonEncodingStreamWrapper.cs
- Compress.cs
- MetabaseSettingsIis7.cs
- XmlQualifiedNameTest.cs
- Vector3DAnimation.cs
- XsdBuilder.cs
- MappingException.cs
- AccessDataSourceView.cs
- Boolean.cs
- LongValidatorAttribute.cs
- DataControlField.cs
- WebPartZoneCollection.cs
- QuotedStringWriteStateInfo.cs
- SecurityHeaderElementInferenceEngine.cs
- BindStream.cs
- RtfFormatStack.cs
- ErasingStroke.cs
- HebrewNumber.cs
- SrgsRuleRef.cs
- ToolStripPanelCell.cs
- MDIControlStrip.cs
- HttpWebResponse.cs
- columnmapkeybuilder.cs
- DelegateBodyWriter.cs
- HtmlTableRow.cs