Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // // ==--== /*============================================================ ** ** 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigXmlElement.cs
- DispatchOperation.cs
- DisplayNameAttribute.cs
- WebZone.cs
- MemoryStream.cs
- KeyValuePair.cs
- PathGeometry.cs
- XmlSchemaComplexType.cs
- _NestedSingleAsyncResult.cs
- List.cs
- _LocalDataStoreMgr.cs
- PersonalizationAdministration.cs
- TableLayout.cs
- XmlBinaryReader.cs
- RowToParametersTransformer.cs
- UserCancellationException.cs
- XmlSchemaSimpleTypeRestriction.cs
- XmlAttribute.cs
- _HeaderInfoTable.cs
- ScrollBar.cs
- UrlAuthFailedErrorFormatter.cs
- PathSegment.cs
- SoapEnumAttribute.cs
- EntityDesignPluralizationHandler.cs
- RemotingService.cs
- FieldMetadata.cs
- Material.cs
- FilterableAttribute.cs
- AccessViolationException.cs
- SecurityDocument.cs
- LogStream.cs
- AuthenticationConfig.cs
- HostingPreferredMapPath.cs
- DataGridDetailsPresenterAutomationPeer.cs
- HttpDictionary.cs
- Win32PrintDialog.cs
- StateValidator.cs
- clipboard.cs
- GAC.cs
- RefreshPropertiesAttribute.cs
- ConfigurationElementProperty.cs
- HostingPreferredMapPath.cs
- ConversionContext.cs
- FamilyMapCollection.cs
- DocumentReference.cs
- CapacityStreamGeometryContext.cs
- IntMinMaxAggregationOperator.cs
- QueryActivatableWorkflowsCommand.cs
- StreamGeometryContext.cs
- ACE.cs
- NumberSubstitution.cs
- QEncodedStream.cs
- FileIOPermission.cs
- ListInitExpression.cs
- ElementHostPropertyMap.cs
- CursorConverter.cs
- ClientEndpointLoader.cs
- DataGridState.cs
- DiscriminatorMap.cs
- SqlDataSourceSummaryPanel.cs
- DownloadProgressEventArgs.cs
- FixedPageAutomationPeer.cs
- EventLogConfiguration.cs
- ConfigXmlText.cs
- DesignerActionItem.cs
- SqlDataAdapter.cs
- RijndaelManagedTransform.cs
- MaterialGroup.cs
- SQLUtility.cs
- IndexedSelectQueryOperator.cs
- FontEmbeddingManager.cs
- TextReader.cs
- WorkflowInstance.cs
- AssertFilter.cs
- IBuiltInEvidence.cs
- HttpPostLocalhostServerProtocol.cs
- sqlstateclientmanager.cs
- PropertyMapper.cs
- Keywords.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- TextChange.cs
- ConfigurationErrorsException.cs
- QueryRewriter.cs
- SerializableAuthorizationContext.cs
- IArgumentProvider.cs
- ButtonBaseDesigner.cs
- GroupQuery.cs
- EntityDataSourceDesignerHelper.cs
- SRGSCompiler.cs
- complextypematerializer.cs
- StyleCollection.cs
- HtmlSelect.cs
- StringValueSerializer.cs
- XmlSchemaSequence.cs
- AtomMaterializerLog.cs
- PropertyIDSet.cs
- ETagAttribute.cs
- DragStartedEventArgs.cs
- Site.cs
- SplineQuaternionKeyFrame.cs