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
- ThreadAttributes.cs
- CellLabel.cs
- IBuiltInEvidence.cs
- UnsafeNativeMethods.cs
- LogicalChannel.cs
- ImageCodecInfoPrivate.cs
- ObjectNotFoundException.cs
- SingleConverter.cs
- ListControl.cs
- PartialClassGenerationTaskInternal.cs
- SoapElementAttribute.cs
- BindableAttribute.cs
- ItemsChangedEventArgs.cs
- TranslateTransform.cs
- PageScaling.cs
- DoWorkEventArgs.cs
- HopperCache.cs
- DatatypeImplementation.cs
- JournalEntryStack.cs
- ArrayList.cs
- XmlWrappingWriter.cs
- SchemaCollectionPreprocessor.cs
- XmlMembersMapping.cs
- HtmlInputRadioButton.cs
- FontInfo.cs
- MdiWindowListItemConverter.cs
- PersonalizationStateInfoCollection.cs
- OdbcEnvironment.cs
- XmlValidatingReader.cs
- WebPartTransformerAttribute.cs
- Brushes.cs
- SupportsEventValidationAttribute.cs
- XamlHostingConfiguration.cs
- SafeNativeMethods.cs
- EmbeddedMailObjectsCollection.cs
- TreePrinter.cs
- AnnouncementService.cs
- GZipDecoder.cs
- MarkupCompilePass2.cs
- DesignerCategoryAttribute.cs
- ThemeableAttribute.cs
- AnnotationHelper.cs
- figurelength.cs
- WebServiceHandlerFactory.cs
- unsafenativemethodsother.cs
- BinaryUtilClasses.cs
- Unit.cs
- SqlMethodCallConverter.cs
- XsltLoader.cs
- LinqDataSourceInsertEventArgs.cs
- AffineTransform3D.cs
- StateRuntime.cs
- EventItfInfo.cs
- EdmType.cs
- UrlPropertyAttribute.cs
- RecordsAffectedEventArgs.cs
- UnsafeNativeMethodsTablet.cs
- Config.cs
- ECDiffieHellmanPublicKey.cs
- DictionarySurrogate.cs
- CodeDirectiveCollection.cs
- FileVersionInfo.cs
- WindowsListViewItemCheckBox.cs
- ResourceSetExpression.cs
- PersonalizableTypeEntry.cs
- DescriptionAttribute.cs
- XmlQualifiedName.cs
- FontStretches.cs
- CharacterMetricsDictionary.cs
- FormViewPagerRow.cs
- DPTypeDescriptorContext.cs
- ScrollBarAutomationPeer.cs
- OrderedHashRepartitionStream.cs
- SkewTransform.cs
- PeerInvitationResponse.cs
- Button.cs
- Line.cs
- dataSvcMapFileLoader.cs
- MetafileHeader.cs
- ElapsedEventArgs.cs
- MetadataCollection.cs
- TdsParser.cs
- RoutedUICommand.cs
- ThicknessAnimation.cs
- ADConnectionHelper.cs
- ObjectParameterCollection.cs
- OutputCacheProfileCollection.cs
- SoapInteropTypes.cs
- ObjectSpanRewriter.cs
- xmlglyphRunInfo.cs
- BitFlagsGenerator.cs
- ResXResourceWriter.cs
- WorkflowViewElement.cs
- TreeNodeStyleCollectionEditor.cs
- util.cs
- DesignerAttribute.cs
- PolyBezierSegment.cs
- remotingproxy.cs
- UnsafeNativeMethods.cs
- XsltOutput.cs