Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImmComposition.cs
- ScriptReference.cs
- coordinatorfactory.cs
- ProviderSettings.cs
- WebEvents.cs
- RootBuilder.cs
- FixedLineResult.cs
- TextTabProperties.cs
- OutputCacheProfileCollection.cs
- SystemIPGlobalProperties.cs
- AuthenticatingEventArgs.cs
- SerialPort.cs
- StructuredType.cs
- PeerChannelListener.cs
- SafeHandles.cs
- TextSpanModifier.cs
- ServiceReference.cs
- HtmlControlAdapter.cs
- TdsParserSessionPool.cs
- DockPattern.cs
- XPathArrayIterator.cs
- OracleDateTime.cs
- SelectedPathEditor.cs
- CompatibleComparer.cs
- GroupByExpressionRewriter.cs
- ComponentConverter.cs
- PeekCompletedEventArgs.cs
- DocumentViewer.cs
- OleDbPermission.cs
- TextTreeInsertUndoUnit.cs
- FacetChecker.cs
- XmlSchemaDocumentation.cs
- SqlBooleanizer.cs
- Cursor.cs
- SqlTriggerContext.cs
- TransformerConfigurationWizardBase.cs
- WebPartAuthorizationEventArgs.cs
- RewritingSimplifier.cs
- ListParaClient.cs
- DoubleLinkList.cs
- BrowsableAttribute.cs
- UpdateCommand.cs
- Cursor.cs
- GridViewHeaderRowPresenter.cs
- MenuCommandsChangedEventArgs.cs
- QilInvokeEarlyBound.cs
- HandlerWithFactory.cs
- UnsafeNativeMethods.cs
- MasterPage.cs
- ConnectivityStatus.cs
- AssemblyHash.cs
- Peer.cs
- OpenTypeLayout.cs
- Executor.cs
- XPathNavigatorKeyComparer.cs
- SqlConnectionStringBuilder.cs
- XmlSchemaElement.cs
- SqlConnectionFactory.cs
- xml.cs
- PageParser.cs
- SelectingProviderEventArgs.cs
- Assert.cs
- ProviderCollection.cs
- streamingZipPartStream.cs
- ExceptionUtil.cs
- AmbientLight.cs
- BinaryObjectReader.cs
- Parsers.cs
- ListViewInsertionMark.cs
- SQLUtility.cs
- ScaleTransform3D.cs
- ValidationErrorCollection.cs
- ObjectDataSource.cs
- DbConnectionPoolIdentity.cs
- DataGridViewCellStateChangedEventArgs.cs
- PathSegmentCollection.cs
- ApplicationProxyInternal.cs
- HotSpot.cs
- PageCatalogPart.cs
- SecurityContextTokenCache.cs
- Menu.cs
- Bezier.cs
- BezierSegment.cs
- SafeUserTokenHandle.cs
- QueryOperator.cs
- SharedPerformanceCounter.cs
- EntityCommandCompilationException.cs
- shaper.cs
- CommandField.cs
- SystemInformation.cs
- MethodExpression.cs
- PackagingUtilities.cs
- QueryCursorEventArgs.cs
- MasterPageParser.cs
- ControlEvent.cs
- PeerCustomResolverBindingElement.cs
- ToolStripDesignerAvailabilityAttribute.cs
- TagMapInfo.cs
- InvalidWMPVersionException.cs
- EmbeddedMailObject.cs