Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ActivityUtilities.cs
- ItemsControl.cs
- StringUtil.cs
- datacache.cs
- Glyph.cs
- TokenBasedSet.cs
- AttributeEmitter.cs
- AttachInfo.cs
- QueryParameter.cs
- TriState.cs
- FullTextBreakpoint.cs
- BasicExpandProvider.cs
- COM2ExtendedTypeConverter.cs
- StylusPlugInCollection.cs
- StrokeNodeData.cs
- DataGridRowEventArgs.cs
- Inline.cs
- Wizard.cs
- DockPanel.cs
- _LocalDataStore.cs
- Convert.cs
- ListControlBuilder.cs
- SoapObjectInfo.cs
- WpfXamlLoader.cs
- AssertFilter.cs
- ResourceExpressionBuilder.cs
- PasswordTextContainer.cs
- ComponentResourceKey.cs
- DebuggerService.cs
- InvalidDataException.cs
- PropertyEmitter.cs
- DataGridViewCellCollection.cs
- DataGridState.cs
- ColumnPropertiesGroup.cs
- DataMisalignedException.cs
- Trigger.cs
- SapiAttributeParser.cs
- SamlSerializer.cs
- InstanceView.cs
- XmlParserContext.cs
- SystemBrushes.cs
- HtmlControl.cs
- PropertyFilterAttribute.cs
- SchemaImporterExtensionElement.cs
- BasePattern.cs
- PersonalizationEntry.cs
- safemediahandle.cs
- InternalControlCollection.cs
- MessageDecoder.cs
- TemplateComponentConnector.cs
- Rect3DConverter.cs
- ISCIIEncoding.cs
- FtpWebResponse.cs
- ImageMapEventArgs.cs
- CompatibleIComparer.cs
- InternalDispatchObject.cs
- TreeNode.cs
- XPathArrayIterator.cs
- WsdlBuildProvider.cs
- AvTraceDetails.cs
- MappingMetadataHelper.cs
- CopyOnWriteList.cs
- ItemCheckedEvent.cs
- OleStrCAMarshaler.cs
- EntityDataSource.cs
- Int16Converter.cs
- SafeSecurityHelper.cs
- RuntimeConfig.cs
- GenericFlowSwitchHelper.cs
- LayoutTableCell.cs
- InvalidCastException.cs
- DataTemplateSelector.cs
- StylusPointCollection.cs
- InkCanvasFeedbackAdorner.cs
- PartialTrustVisibleAssembly.cs
- AssertFilter.cs
- COAUTHIDENTITY.cs
- ConfigurationLocationCollection.cs
- WebReferencesBuildProvider.cs
- SamlSubject.cs
- VisualBrush.cs
- DetailsViewCommandEventArgs.cs
- SystemMulticastIPAddressInformation.cs
- WebBrowser.cs
- BindingMAnagerBase.cs
- Thread.cs
- ModulesEntry.cs
- HttpRequestWrapper.cs
- ByteRangeDownloader.cs
- StandardCommands.cs
- ThrowOnMultipleAssignment.cs
- ToolStripArrowRenderEventArgs.cs
- DataColumnChangeEvent.cs
- ObfuscationAttribute.cs
- AttachedPropertyMethodSelector.cs
- ResourceDescriptionAttribute.cs
- IsolatedStorageFile.cs
- WebPartCatalogCloseVerb.cs
- SerialStream.cs
- DllNotFoundException.cs