Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MsmqIntegrationAppDomainProtocolHandler.cs
- Bitmap.cs
- BitmapScalingModeValidation.cs
- ActivityExecutor.cs
- ReliableSessionElement.cs
- Rect3D.cs
- UInt32.cs
- ScriptingRoleServiceSection.cs
- TypeReference.cs
- BufferedGraphicsManager.cs
- MapPathBasedVirtualPathProvider.cs
- TreeViewHitTestInfo.cs
- DrawingAttributes.cs
- MsmqIntegrationSecurityElement.cs
- SapiInterop.cs
- SiteMapNodeItem.cs
- TripleDES.cs
- SpecialFolderEnumConverter.cs
- PanelStyle.cs
- Subtree.cs
- XmlnsCache.cs
- QilTypeChecker.cs
- DataMisalignedException.cs
- OleDbConnectionFactory.cs
- SmtpTransport.cs
- ToolStripSplitStackLayout.cs
- sqlnorm.cs
- OleDbParameterCollection.cs
- SkinBuilder.cs
- GenericTextProperties.cs
- ProgressiveCrcCalculatingStream.cs
- Permission.cs
- CommonXSendMessage.cs
- XPathMultyIterator.cs
- CalendarDay.cs
- ScrollChangedEventArgs.cs
- Authorization.cs
- BuildProviderCollection.cs
- CorrelationManager.cs
- EdmFunction.cs
- DynamicRendererThreadManager.cs
- SID.cs
- CompiledWorkflowDefinitionContext.cs
- CallbackValidatorAttribute.cs
- GridViewRowCollection.cs
- WindowsListViewItemStartMenu.cs
- XmlSchemaValidationException.cs
- LifetimeManager.cs
- FontWeightConverter.cs
- SmtpAuthenticationManager.cs
- DATA_BLOB.cs
- SectionInput.cs
- RecipientInfo.cs
- DataGridViewControlCollection.cs
- PageRanges.cs
- VScrollProperties.cs
- CurrentChangingEventArgs.cs
- ProcessModuleDesigner.cs
- EventEntry.cs
- AxDesigner.cs
- BinaryFormatter.cs
- WeakEventTable.cs
- CellCreator.cs
- TypeSystemHelpers.cs
- LocalTransaction.cs
- TraceEventCache.cs
- ScriptManagerProxy.cs
- SplitterEvent.cs
- ChtmlTextWriter.cs
- ToolStripDropDownClosingEventArgs.cs
- SizeAnimationClockResource.cs
- ContextBase.cs
- XmlSchemaType.cs
- SuppressMergeCheckAttribute.cs
- ExtenderControl.cs
- RelatedPropertyManager.cs
- ProtocolViolationException.cs
- DependencyObjectProvider.cs
- WebControl.cs
- SegmentInfo.cs
- Style.cs
- PropertyChangingEventArgs.cs
- Win32Native.cs
- CodeCatchClauseCollection.cs
- CodeConstructor.cs
- SymLanguageVendor.cs
- Console.cs
- DataListItemCollection.cs
- EncoderExceptionFallback.cs
- FileChangeNotifier.cs
- PathSegment.cs
- OpCellTreeNode.cs
- DataGridItem.cs
- HttpEncoderUtility.cs
- ServiceNameCollection.cs
- MonitorWrapper.cs
- FlowLayoutPanel.cs
- ListViewItemMouseHoverEvent.cs
- MessageOperationFormatter.cs
- LeafCellTreeNode.cs