Code:
/ DotNET / DotNET / 8.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
- TemplatedWizardStep.cs
- TimerElapsedEvenArgs.cs
- WorkflowMarkupSerializationProvider.cs
- Collection.cs
- ListViewContainer.cs
- WebPartManager.cs
- RectangleConverter.cs
- EditingCommands.cs
- Simplifier.cs
- AccessViolationException.cs
- BamlStream.cs
- Win32Exception.cs
- SqlComparer.cs
- StickyNoteContentControl.cs
- TemplateAction.cs
- NoPersistProperty.cs
- MouseEvent.cs
- ExecutionEngineException.cs
- ModifierKeysValueSerializer.cs
- AnimationTimeline.cs
- Pkcs7Signer.cs
- ExpressionBuilder.cs
- Number.cs
- _RequestLifetimeSetter.cs
- XmlSchemaException.cs
- WindowsGraphicsWrapper.cs
- TileBrush.cs
- ModuleBuilderData.cs
- SecureUICommand.cs
- LiteralText.cs
- MDIControlStrip.cs
- ObjectSet.cs
- Hash.cs
- InfocardChannelParameter.cs
- SerializationInfoEnumerator.cs
- LinqDataSourceContextEventArgs.cs
- HtmlWindowCollection.cs
- SplineKeyFrames.cs
- XamlHostingConfiguration.cs
- ValueTypeFixupInfo.cs
- HttpProcessUtility.cs
- TokenBasedSetEnumerator.cs
- PageTheme.cs
- GacUtil.cs
- CryptoHandle.cs
- ButtonFlatAdapter.cs
- CqlIdentifiers.cs
- DbConnectionPoolOptions.cs
- WaitingCursor.cs
- Crc32.cs
- IInstanceContextProvider.cs
- CurrencyWrapper.cs
- ConnectionStringsExpressionBuilder.cs
- Inflater.cs
- TdsParserHelperClasses.cs
- HttpsHostedTransportConfiguration.cs
- XmlnsCompatibleWithAttribute.cs
- RtType.cs
- TextDecorationLocationValidation.cs
- ConfigurationStrings.cs
- CompressStream.cs
- MSAAWinEventWrap.cs
- ClientFormsAuthenticationCredentials.cs
- PermissionToken.cs
- Message.cs
- EntityDataSourceSelectedEventArgs.cs
- KnownTypeAttribute.cs
- DebugInfoExpression.cs
- EraserBehavior.cs
- CompareValidator.cs
- RecordBuilder.cs
- SafeCertificateContext.cs
- ContentHostHelper.cs
- DataGridViewToolTip.cs
- PassportAuthenticationModule.cs
- ReachDocumentPageSerializerAsync.cs
- PeerName.cs
- SourceLineInfo.cs
- DocumentCollection.cs
- AlphabeticalEnumConverter.cs
- AdRotator.cs
- SystemColors.cs
- Matrix.cs
- VirtualPathUtility.cs
- OleDbConnectionInternal.cs
- DataGridItemCollection.cs
- ReliableMessagingHelpers.cs
- OleDbParameter.cs
- ControlBuilderAttribute.cs
- WeakReferenceEnumerator.cs
- DivideByZeroException.cs
- RenderDataDrawingContext.cs
- HttpServerProtocol.cs
- NavigatingCancelEventArgs.cs
- RuntimeConfig.cs
- Configuration.cs
- RemotingService.cs
- StsCommunicationException.cs
- SelectionPattern.cs
- CodeSnippetTypeMember.cs