Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / Serialization / SerializationObjectManager.cs / 1305376 / 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(); } [System.Security.SecurityCritical] // auto-generated_required 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. // // ==--== /*============================================================ ** ** 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(); } [System.Security.SecurityCritical] // auto-generated_required 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProfileBuildProvider.cs
- ServiceCredentialsSecurityTokenManager.cs
- DataGridTablesFactory.cs
- OdbcConnectionOpen.cs
- WindowsGraphics2.cs
- SinglePageViewer.cs
- CodePageEncoding.cs
- CookielessHelper.cs
- OperationInvokerBehavior.cs
- XamlStream.cs
- DecoderNLS.cs
- SecurityState.cs
- VirtualPath.cs
- ReversePositionQuery.cs
- MultipleViewPattern.cs
- FrameworkElementAutomationPeer.cs
- TargetFrameworkUtil.cs
- LocalizationCodeDomSerializer.cs
- EdmProperty.cs
- GenericXmlSecurityToken.cs
- PartBasedPackageProperties.cs
- BamlRecords.cs
- SemanticValue.cs
- QueryAccessibilityHelpEvent.cs
- ClientProxyGenerator.cs
- FileStream.cs
- TableDetailsCollection.cs
- RadioButtonStandardAdapter.cs
- UpdateCompiler.cs
- PreDigestedSignedInfo.cs
- ContentDisposition.cs
- ZipPackagePart.cs
- StretchValidation.cs
- Point.cs
- ValidationSummary.cs
- DataGridComponentEditor.cs
- SmtpDigestAuthenticationModule.cs
- ResXResourceReader.cs
- TagPrefixAttribute.cs
- SourceSwitch.cs
- SchemaImporterExtensionElement.cs
- ResourceManager.cs
- ObsoleteAttribute.cs
- ErrorFormatter.cs
- AccessibleObject.cs
- RichTextBoxAutomationPeer.cs
- DataPointer.cs
- SectionVisual.cs
- Enum.cs
- WebPartManagerInternals.cs
- DecoderFallbackWithFailureFlag.cs
- ShaderEffect.cs
- Directory.cs
- MutexSecurity.cs
- SQLDateTime.cs
- FormsAuthenticationModule.cs
- thaishape.cs
- PagerSettings.cs
- RuleProcessor.cs
- EventLogEntry.cs
- CssTextWriter.cs
- ETagAttribute.cs
- PassportIdentity.cs
- CallbackDebugBehavior.cs
- EventHandlerList.cs
- RuleDefinitions.cs
- MsmqTransportReceiveParameters.cs
- FrameworkRichTextComposition.cs
- BamlLocalizableResource.cs
- WpfWebRequestHelper.cs
- FileDialogPermission.cs
- PermissionListSet.cs
- _NegotiateClient.cs
- CodeDelegateInvokeExpression.cs
- MetafileHeader.cs
- TextMarkerSource.cs
- InputElement.cs
- ToolbarAUtomationPeer.cs
- IERequestCache.cs
- OracleTimeSpan.cs
- CodeTypeParameter.cs
- TemplatedAdorner.cs
- ChildTable.cs
- RelationshipSet.cs
- SqlProfileProvider.cs
- ToolstripProfessionalRenderer.cs
- DataPointer.cs
- HeaderedContentControl.cs
- FieldToken.cs
- Location.cs
- GenericEnumConverter.cs
- NameValueSectionHandler.cs
- MaskedTextBoxTextEditorDropDown.cs
- PeoplePickerWrapper.cs
- XmlSchemaException.cs
- Function.cs
- ReadWriteSpinLock.cs
- WebPartConnectVerb.cs
- SingleSelectRootGridEntry.cs
- ItemsPanelTemplate.cs