Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // // ==--== /*============================================================ ** ** 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MulticastNotSupportedException.cs
- PageParser.cs
- PowerStatus.cs
- SystemPens.cs
- Gdiplus.cs
- ComplusTypeValidator.cs
- Rectangle.cs
- AppDomain.cs
- ThaiBuddhistCalendar.cs
- TextFormatterContext.cs
- DataStorage.cs
- PageFunction.cs
- ProcessHost.cs
- DbConnectionPoolOptions.cs
- FamilyMapCollection.cs
- EmptyWithCancelationCheckWorkItem.cs
- SqlBulkCopyColumnMappingCollection.cs
- RelationshipConverter.cs
- WorkflowClientDeliverMessageWrapper.cs
- CodeDirectiveCollection.cs
- OleDbConnection.cs
- TypeExtensions.cs
- HttpListenerRequestUriBuilder.cs
- AppliedDeviceFiltersEditor.cs
- BStrWrapper.cs
- SmtpFailedRecipientException.cs
- WebPartVerb.cs
- SafeUserTokenHandle.cs
- DependencyObjectCodeDomSerializer.cs
- Matrix3DConverter.cs
- Adorner.cs
- XmlCDATASection.cs
- Component.cs
- LocatorManager.cs
- ArgumentNullException.cs
- HasCopySemanticsAttribute.cs
- TraceEventCache.cs
- ContentElement.cs
- XPathNodeHelper.cs
- Transform3DGroup.cs
- VBIdentifierNameEditor.cs
- HtmlListAdapter.cs
- mediapermission.cs
- BatchParser.cs
- DnsEndPoint.cs
- IndentedWriter.cs
- SqlRowUpdatedEvent.cs
- BooleanSwitch.cs
- HelpKeywordAttribute.cs
- SqlMethodTransformer.cs
- DataGridViewCellEventArgs.cs
- UIHelper.cs
- WebPartConnectionsCancelEventArgs.cs
- RTLAwareMessageBox.cs
- ResolvePPIDRequest.cs
- TransactionState.cs
- EventsTab.cs
- ServiceAuthorizationElement.cs
- VerificationAttribute.cs
- QilTernary.cs
- ListItemDetailViewAttribute.cs
- PageAsyncTask.cs
- CryptoApi.cs
- EditorBrowsableAttribute.cs
- DeviceContext2.cs
- Button.cs
- TextEditorContextMenu.cs
- IEnumerable.cs
- CompositeFontFamily.cs
- GeometryCollection.cs
- XmlSchemaSimpleType.cs
- TripleDES.cs
- TypeViewSchema.cs
- DrawListViewColumnHeaderEventArgs.cs
- DiagnosticTraceSchemas.cs
- MailSettingsSection.cs
- Nodes.cs
- ObjectViewQueryResultData.cs
- SafeReversePInvokeHandle.cs
- HtmlLink.cs
- StyleBamlRecordReader.cs
- GPPOINT.cs
- Visual3D.cs
- RichTextBox.cs
- FactoryMaker.cs
- TextEditorTyping.cs
- XmlSchemaRedefine.cs
- CodeAccessSecurityEngine.cs
- BlurBitmapEffect.cs
- BooleanFacetDescriptionElement.cs
- DataGridSortCommandEventArgs.cs
- HebrewNumber.cs
- EnumType.cs
- VerticalAlignConverter.cs
- EntityType.cs
- DesignerAttributeInfo.cs
- UIHelper.cs
- SQLResource.cs
- ColorConvertedBitmapExtension.cs
- ListViewDeletedEventArgs.cs