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
- EntityDataSourceColumn.cs
- FacetValueContainer.cs
- TypeForwardedToAttribute.cs
- ReflectionUtil.cs
- PreProcessInputEventArgs.cs
- Error.cs
- CollectionChangeEventArgs.cs
- CapabilitiesAssignment.cs
- HttpModuleCollection.cs
- XslAst.cs
- CredentialCache.cs
- MsmqMessage.cs
- ITreeGenerator.cs
- HttpChannelFactory.cs
- ReadingWritingEntityEventArgs.cs
- OutputCacheProfileCollection.cs
- EventProviderWriter.cs
- WorkflowDesigner.cs
- MatrixAnimationBase.cs
- ExternalFile.cs
- EdmItemCollection.cs
- CodeEventReferenceExpression.cs
- ConfigurationManagerHelper.cs
- MessageSmuggler.cs
- UidManager.cs
- BehaviorEditorPart.cs
- CodeDirectionExpression.cs
- GuidelineCollection.cs
- Material.cs
- PreDigestedSignedInfo.cs
- SettingsPropertyValue.cs
- TabControlAutomationPeer.cs
- EntryPointNotFoundException.cs
- ParseHttpDate.cs
- ZipQueryOperator.cs
- ScrollEventArgs.cs
- DataDocumentXPathNavigator.cs
- TextWriterTraceListener.cs
- StorageEndPropertyMapping.cs
- InstanceCreationEditor.cs
- TextOnlyOutput.cs
- SiteMapNodeItem.cs
- XamlRtfConverter.cs
- SurrogateDataContract.cs
- DefaultTextStore.cs
- Int32Rect.cs
- Transform3DGroup.cs
- SizeConverter.cs
- VersionedStream.cs
- GlobalizationSection.cs
- FontUnit.cs
- AsyncResult.cs
- HtmlTableRowCollection.cs
- OdbcEnvironmentHandle.cs
- OverflowException.cs
- SqlDuplicator.cs
- HtmlTableCellCollection.cs
- ItemType.cs
- Expressions.cs
- ResourceSet.cs
- PrintPageEvent.cs
- GlyphingCache.cs
- SafeSecurityHelper.cs
- ResXResourceReader.cs
- ButtonChrome.cs
- SingleTagSectionHandler.cs
- MatrixConverter.cs
- ConfigXmlReader.cs
- WebPartConnectionCollection.cs
- Vector3D.cs
- DesignerVerb.cs
- TagPrefixInfo.cs
- SqlDataReader.cs
- IxmlLineInfo.cs
- ParameterCollection.cs
- NavigationPropertySingletonExpression.cs
- StringInfo.cs
- ConfigurationValues.cs
- WebPartMovingEventArgs.cs
- DeflateStream.cs
- UserControlBuildProvider.cs
- FormsIdentity.cs
- InputScopeAttribute.cs
- GlobalItem.cs
- CoreChannel.cs
- UnaryQueryOperator.cs
- DataRelationPropertyDescriptor.cs
- SqlDataSourceQueryEditorForm.cs
- EventBuilder.cs
- DataGrid.cs
- OracleConnection.cs
- ContentAlignmentEditor.cs
- QuadraticBezierSegment.cs
- BehaviorService.cs
- ActiveDocumentEvent.cs
- HtmlGenericControl.cs
- RadioButtonBaseAdapter.cs
- AppDomainResourcePerfCounters.cs
- ScaleTransform3D.cs
- SqlCaseSimplifier.cs