Code:
/ 4.0 / 4.0 / 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. // ==++== // // 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
- RecordConverter.cs
- ArrayTypeMismatchException.cs
- FilterableAttribute.cs
- DataGridViewCellLinkedList.cs
- CodeBlockBuilder.cs
- SqlLiftIndependentRowExpressions.cs
- CategoryAttribute.cs
- CodeAssignStatement.cs
- XmlAttribute.cs
- StorageScalarPropertyMapping.cs
- MenuAdapter.cs
- AliasedExpr.cs
- PageSettings.cs
- GridToolTip.cs
- AssemblyAttributesGoHere.cs
- TextRangeSerialization.cs
- ExpandSegment.cs
- HtmlInputCheckBox.cs
- XmlCompatibilityReader.cs
- EntityKeyElement.cs
- Claim.cs
- AdornerPresentationContext.cs
- FlagsAttribute.cs
- QilPatternFactory.cs
- SqlAliaser.cs
- ThumbAutomationPeer.cs
- SystemInfo.cs
- base64Transforms.cs
- _OSSOCK.cs
- GeometryCollection.cs
- Color.cs
- ObjectDataSourceChooseMethodsPanel.cs
- Win32KeyboardDevice.cs
- X509ChainElement.cs
- log.cs
- IntSecurity.cs
- DbProviderConfigurationHandler.cs
- CreateUserWizardStep.cs
- EntityStoreSchemaGenerator.cs
- QueryExpr.cs
- EventWaitHandleSecurity.cs
- DXD.cs
- WriteableBitmap.cs
- TaiwanCalendar.cs
- SignatureDescription.cs
- XslCompiledTransform.cs
- TimeSpanParse.cs
- PropertyInformation.cs
- HitTestWithPointDrawingContextWalker.cs
- ComplexTypeEmitter.cs
- SecurityPolicySection.cs
- DataControlFieldCollection.cs
- AtomEntry.cs
- Debug.cs
- EncryptedPackageFilter.cs
- RegexGroupCollection.cs
- PtsPage.cs
- CompiledRegexRunner.cs
- Material.cs
- LingerOption.cs
- ObjectReaderCompiler.cs
- ServiceParser.cs
- EventListenerClientSide.cs
- HtmlInputSubmit.cs
- StorageInfo.cs
- TreeViewItemAutomationPeer.cs
- ComboBox.cs
- RectAnimationClockResource.cs
- UnsafeNativeMethods.cs
- _IPv4Address.cs
- SelectorAutomationPeer.cs
- PageContentAsyncResult.cs
- BlobPersonalizationState.cs
- GcHandle.cs
- VariantWrapper.cs
- SchemaNames.cs
- InvalidCastException.cs
- HtmlElementEventArgs.cs
- ITextView.cs
- WSSecureConversationDec2005.cs
- XmlAttributeCollection.cs
- RangeContentEnumerator.cs
- Calendar.cs
- ParallelQuery.cs
- initElementDictionary.cs
- IntegerValidator.cs
- WindowsStatic.cs
- EdmEntityTypeAttribute.cs
- TextElement.cs
- RewritingSimplifier.cs
- UnsafeCollabNativeMethods.cs
- DataServiceContext.cs
- UnsafeNetInfoNativeMethods.cs
- IteratorFilter.cs
- NotConverter.cs
- TextServicesLoader.cs
- StrongNameHelpers.cs
- TextPatternIdentifiers.cs
- KerberosReceiverSecurityToken.cs
- RsaEndpointIdentity.cs