Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PrintingPermission.cs
- SecurityKeyIdentifier.cs
- AppSettingsSection.cs
- EllipseGeometry.cs
- RuntimeArgumentHandle.cs
- Label.cs
- DataGridView.cs
- Bezier.cs
- DataObjectAttribute.cs
- StylusPointProperty.cs
- InputLanguageCollection.cs
- UrlPropertyAttribute.cs
- HistoryEventArgs.cs
- TextServicesLoader.cs
- Utils.cs
- IdnElement.cs
- TextViewBase.cs
- TextLine.cs
- DesignerLabelAdapter.cs
- OverrideMode.cs
- HtmlFormAdapter.cs
- CurrencyWrapper.cs
- FigureParaClient.cs
- HtmlInputRadioButton.cs
- Authorization.cs
- Tuple.cs
- BitmapEffectDrawing.cs
- behaviorssection.cs
- PeerToPeerException.cs
- RangeValidator.cs
- MyContact.cs
- DesignerCategoryAttribute.cs
- PriorityBinding.cs
- PeerTransportBindingElement.cs
- HttpContext.cs
- KerberosSecurityTokenAuthenticator.cs
- WebServiceTypeData.cs
- MarkerProperties.cs
- SetterTriggerConditionValueConverter.cs
- TrackingProfile.cs
- Visitor.cs
- FactoryGenerator.cs
- AssociatedControlConverter.cs
- XsdDateTime.cs
- CodeTypeParameter.cs
- xamlnodes.cs
- FacetEnabledSchemaElement.cs
- _Events.cs
- Stylesheet.cs
- HttpStreams.cs
- ColorConverter.cs
- QilFactory.cs
- Baml6Assembly.cs
- CodeTypeReference.cs
- DesignerGeometryHelper.cs
- AsymmetricCryptoHandle.cs
- UnsafeNativeMethodsCLR.cs
- SqlDataSourceEnumerator.cs
- EntityDesignerDataSourceView.cs
- FlowDocumentPageViewerAutomationPeer.cs
- CallbackCorrelationInitializer.cs
- DbSourceCommand.cs
- NestPullup.cs
- ApplicationInfo.cs
- OdbcParameter.cs
- SolidColorBrush.cs
- MdiWindowListItemConverter.cs
- TrailingSpaceComparer.cs
- ArrayWithOffset.cs
- SessionSymmetricMessageSecurityProtocolFactory.cs
- ProfilePropertyNameValidator.cs
- remotingproxy.cs
- LinkLabel.cs
- WebPartTransformerCollection.cs
- HttpModuleCollection.cs
- Screen.cs
- HostSecurityManager.cs
- InvalidCommandTreeException.cs
- ObjRef.cs
- EditModeSwitchButton.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- TypeToStringValueConverter.cs
- Graphics.cs
- SqlDataSourceFilteringEventArgs.cs
- FileStream.cs
- MsmqProcessProtocolHandler.cs
- PromptBuilder.cs
- SerialReceived.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- GraphicsContainer.cs
- Vector3DConverter.cs
- CacheHelper.cs
- SplineKeyFrames.cs
- SafeThemeHandle.cs
- MatchSingleFxEngineOpcode.cs
- ModelItemImpl.cs
- Rect.cs
- PointLight.cs
- SqlStatistics.cs
- LogConverter.cs