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
- XmlNullResolver.cs
- UnsignedPublishLicense.cs
- DllNotFoundException.cs
- QueueTransferProtocol.cs
- VirtualPathProvider.cs
- NopReturnReader.cs
- XmlSchemaObjectTable.cs
- RoleManagerModule.cs
- Object.cs
- X509CertificateValidator.cs
- UIElementParagraph.cs
- CollectionBase.cs
- TraceContextRecord.cs
- DeferredTextReference.cs
- PagesChangedEventArgs.cs
- NativeMethods.cs
- SingleAnimationUsingKeyFrames.cs
- LineBreakRecord.cs
- LineServicesRun.cs
- SQLDecimalStorage.cs
- _OverlappedAsyncResult.cs
- VerificationException.cs
- ColumnClickEvent.cs
- ChannelSinkStacks.cs
- NumberFunctions.cs
- ConfigXmlText.cs
- FormsIdentity.cs
- WhereQueryOperator.cs
- XmlExceptionHelper.cs
- GenericParameterDataContract.cs
- ServicesExceptionNotHandledEventArgs.cs
- BoundField.cs
- HtmlUtf8RawTextWriter.cs
- ProxyGenerator.cs
- XmlDomTextWriter.cs
- GridViewUpdatedEventArgs.cs
- GridViewPageEventArgs.cs
- SQLBoolean.cs
- StrokeCollectionDefaultValueFactory.cs
- DataGridViewIntLinkedList.cs
- ResourceReader.cs
- FactoryRecord.cs
- InkPresenterAutomationPeer.cs
- WorkflowTraceTransfer.cs
- PrePrepareMethodAttribute.cs
- DataGridViewHitTestInfo.cs
- WebBrowserNavigatingEventHandler.cs
- DependencyPropertyKey.cs
- Match.cs
- LoginUtil.cs
- IdentityValidationException.cs
- UnitySerializationHolder.cs
- TraceListener.cs
- PropertyRecord.cs
- DoubleMinMaxAggregationOperator.cs
- XhtmlBasicLiteralTextAdapter.cs
- CodeCatchClause.cs
- RegexWorker.cs
- ModelEditingScope.cs
- SaveWorkflowAsyncResult.cs
- InvokePatternIdentifiers.cs
- Dispatcher.cs
- GPRECT.cs
- MessageBox.cs
- XmlUnspecifiedAttribute.cs
- TextEditorDragDrop.cs
- RtfToken.cs
- ClientReliableChannelBinder.cs
- TableItemPatternIdentifiers.cs
- WSDualHttpSecurity.cs
- StylusSystemGestureEventArgs.cs
- CalendarDay.cs
- RecognizerInfo.cs
- TableRow.cs
- TimeSpanStorage.cs
- WebPartEditorOkVerb.cs
- DataColumnMapping.cs
- ToolboxItem.cs
- EndpointIdentityConverter.cs
- Iis7Helper.cs
- ObfuscationAttribute.cs
- FormParameter.cs
- cookiecollection.cs
- Bind.cs
- RsaSecurityKey.cs
- EventPrivateKey.cs
- LogExtent.cs
- Enum.cs
- FunctionImportMapping.cs
- ForwardPositionQuery.cs
- Cursor.cs
- EmptyEnumerator.cs
- SystemThemeKey.cs
- ConfigurationProperty.cs
- StylusCaptureWithinProperty.cs
- AsymmetricCryptoHandle.cs
- messageonlyhwndwrapper.cs
- XPathNodeList.cs
- ThreadInterruptedException.cs
- ArcSegment.cs