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
- SpanIndex.cs
- MembershipAdapter.cs
- RectAnimationClockResource.cs
- SqlConnectionHelper.cs
- DispatchWrapper.cs
- CodeValidator.cs
- TabControlAutomationPeer.cs
- _NetworkingPerfCounters.cs
- ServerIdentity.cs
- ContentPlaceHolder.cs
- Metadata.cs
- GeometryGroup.cs
- SafeNativeMethods.cs
- FixedBufferAttribute.cs
- DragStartedEventArgs.cs
- DocumentSchemaValidator.cs
- XmlSchemaRedefine.cs
- XmlWrappingReader.cs
- XPathItem.cs
- Matrix3DConverter.cs
- SqlCacheDependency.cs
- XmlValueConverter.cs
- XmlDeclaration.cs
- MissingMemberException.cs
- AudioFormatConverter.cs
- FontDialog.cs
- linebase.cs
- SamlAuthorizationDecisionStatement.cs
- IPAddress.cs
- BufferedResponseStream.cs
- TransactionChannelFaultConverter.cs
- FieldToken.cs
- ListViewInsertEventArgs.cs
- ErrorsHelper.cs
- GPRECT.cs
- KeyboardDevice.cs
- SymLanguageVendor.cs
- IdentityHolder.cs
- MetadataArtifactLoaderResource.cs
- AsmxEndpointPickerExtension.cs
- isolationinterop.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- ToolStripItemBehavior.cs
- OracleException.cs
- BitmapEffectDrawing.cs
- ISSmlParser.cs
- ConstraintCollection.cs
- DynamicPropertyReader.cs
- PageParserFilter.cs
- ProvidersHelper.cs
- WasHttpHandlersInstallComponent.cs
- OdbcConnectionOpen.cs
- OdbcEnvironment.cs
- ResXFileRef.cs
- TimeSpanValidatorAttribute.cs
- DupHandleConnectionReader.cs
- AutomationPatternInfo.cs
- ArraySortHelper.cs
- DynamicMetaObjectBinder.cs
- MembershipSection.cs
- HorizontalAlignConverter.cs
- ParentUndoUnit.cs
- UITypeEditor.cs
- XmlAtomicValue.cs
- SchemaNotation.cs
- Rotation3D.cs
- CompilerWrapper.cs
- DBSchemaRow.cs
- DoubleLink.cs
- ScriptHandlerFactory.cs
- ResourceDictionaryCollection.cs
- XmlToDatasetMap.cs
- PriorityQueue.cs
- DrawingGroup.cs
- AstTree.cs
- ConfigurationStrings.cs
- IntSecurity.cs
- LockedBorderGlyph.cs
- TemplateEditingFrame.cs
- HtmlDocument.cs
- DeadCharTextComposition.cs
- FixedSOMLineCollection.cs
- TextFormatterHost.cs
- DynamicRendererThreadManager.cs
- odbcmetadatacolumnnames.cs
- WhitespaceRuleReader.cs
- SafeLibraryHandle.cs
- ContentType.cs
- MatrixCamera.cs
- InvokeGenerator.cs
- SiteMap.cs
- FunctionCommandText.cs
- Container.cs
- UTF32Encoding.cs
- ForceCopyBuildProvider.cs
- Expression.cs
- ELinqQueryState.cs
- ComEventsInfo.cs
- XPathBuilder.cs
- Message.cs