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
- COM2IDispatchConverter.cs
- WpfPayload.cs
- StyleConverter.cs
- PageTheme.cs
- ShadowGlyph.cs
- TraceSection.cs
- ZipIOBlockManager.cs
- DateTimeFormatInfo.cs
- InvalidPrinterException.cs
- HashCodeCombiner.cs
- SoapFault.cs
- Mappings.cs
- DBParameter.cs
- HelpInfo.cs
- XmlSerializerVersionAttribute.cs
- TextSimpleMarkerProperties.cs
- AssemblySettingAttributes.cs
- GridViewColumnCollectionChangedEventArgs.cs
- MgmtConfigurationRecord.cs
- PeerEndPoint.cs
- QilStrConcat.cs
- HtmlElement.cs
- SizeChangedEventArgs.cs
- XmlSiteMapProvider.cs
- FixedFindEngine.cs
- EntityClassGenerator.cs
- ActivityPreviewDesigner.cs
- HashHelper.cs
- ServiceDescriptionReflector.cs
- IpcManager.cs
- GradientBrush.cs
- DrawingCollection.cs
- StorageEntityTypeMapping.cs
- Control.cs
- ViewStateModeByIdAttribute.cs
- DriveInfo.cs
- RtfToXamlLexer.cs
- Processor.cs
- Exceptions.cs
- ColumnMapVisitor.cs
- PenContext.cs
- MenuTracker.cs
- MembershipValidatePasswordEventArgs.cs
- SourceElementsCollection.cs
- GridViewItemAutomationPeer.cs
- TransformerInfo.cs
- ExternalException.cs
- _BufferOffsetSize.cs
- QuarticEase.cs
- CommittableTransaction.cs
- StringDictionaryEditor.cs
- SelectionEditingBehavior.cs
- SoapAttributes.cs
- AudioStateChangedEventArgs.cs
- TransformedBitmap.cs
- DataGridTable.cs
- XmlDataSourceNodeDescriptor.cs
- DeviceFilterEditorDialog.cs
- EntityDataSourceDataSelectionPanel.cs
- ConfigurationManagerInternalFactory.cs
- RequiredAttributeAttribute.cs
- PasswordRecovery.cs
- WindowHideOrCloseTracker.cs
- Html32TextWriter.cs
- __Error.cs
- DocumentPageView.cs
- List.cs
- DataGridViewSelectedRowCollection.cs
- Empty.cs
- LabelTarget.cs
- ProfileSection.cs
- OdbcCommandBuilder.cs
- BinarySerializer.cs
- SoapEnumAttribute.cs
- AuthenticationManager.cs
- GeometryDrawing.cs
- querybuilder.cs
- FontWeight.cs
- CellIdBoolean.cs
- BooleanExpr.cs
- DoubleLink.cs
- SafeFileMappingHandle.cs
- MSAAEventDispatcher.cs
- TableRowCollection.cs
- FontInfo.cs
- HtmlGenericControl.cs
- WebService.cs
- ItemDragEvent.cs
- AspCompat.cs
- CacheOutputQuery.cs
- BStrWrapper.cs
- BuildResultCache.cs
- SystemColors.cs
- XmlSchemaChoice.cs
- DataSet.cs
- MsmqInputMessage.cs
- ADMembershipProvider.cs
- Style.cs
- NamespaceQuery.cs
- EdmMember.cs