Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ContextInformation.cs / 1305376 / ContextInformation.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; namespace System.Configuration { // ContextInformation // // Class that encapsulates all of the Context Information that // is going to be associated with a ConfigurationElement // public sealed class ContextInformation { private bool _hostingContextEvaluated; // Do we know the Context? private object _hostingContext; // HostingContext private BaseConfigurationRecord _configRecord; // Constructor // // internal ContextInformation( BaseConfigurationRecord configRecord ) { Debug.Assert(configRecord != null, "configRecord != null"); _hostingContextEvaluated = false; _hostingContext = null; _configRecord = configRecord; } // HostingContext // // Retrieve the Context of the environment that we are being // evaluated in. (currently this can we WebContext, ExeContext, // or null) // public object HostingContext { get { if ( !_hostingContextEvaluated ) { // Retrieve Context _hostingContext = _configRecord.ConfigContext; _hostingContextEvaluated = true; } return _hostingContext; } } // IsMachineLevel // // Is this the machine.config file or not? If it is not // then use the Hosting Context to determine where you are // and in what hierarchy you are in // public bool IsMachineLevel { get { return _configRecord.IsMachineConfig; } } // GetSection // // Get a Section within the context of where we are. What // ever section you retrieve here will be at the same level // in the hierarchy as we are. // // Note: Watch out for a situation where you request a section // that will call you. // public object GetSection(string sectionName) { return _configRecord.GetSection(sectionName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; namespace System.Configuration { // ContextInformation // // Class that encapsulates all of the Context Information that // is going to be associated with a ConfigurationElement // public sealed class ContextInformation { private bool _hostingContextEvaluated; // Do we know the Context? private object _hostingContext; // HostingContext private BaseConfigurationRecord _configRecord; // Constructor // // internal ContextInformation( BaseConfigurationRecord configRecord ) { Debug.Assert(configRecord != null, "configRecord != null"); _hostingContextEvaluated = false; _hostingContext = null; _configRecord = configRecord; } // HostingContext // // Retrieve the Context of the environment that we are being // evaluated in. (currently this can we WebContext, ExeContext, // or null) // public object HostingContext { get { if ( !_hostingContextEvaluated ) { // Retrieve Context _hostingContext = _configRecord.ConfigContext; _hostingContextEvaluated = true; } return _hostingContext; } } // IsMachineLevel // // Is this the machine.config file or not? If it is not // then use the Hosting Context to determine where you are // and in what hierarchy you are in // public bool IsMachineLevel { get { return _configRecord.IsMachineConfig; } } // GetSection // // Get a Section within the context of where we are. What // ever section you retrieve here will be at the same level // in the hierarchy as we are. // // Note: Watch out for a situation where you request a section // that will call you. // public object GetSection(string sectionName) { return _configRecord.GetSection(sectionName); } } } // 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
- OpenFileDialog.cs
- Label.cs
- DataPointer.cs
- ColorIndependentAnimationStorage.cs
- FlowLayout.cs
- Schema.cs
- DomainConstraint.cs
- ParamArrayAttribute.cs
- SuppressMessageAttribute.cs
- XmlElementAttributes.cs
- GlyphInfoList.cs
- ServiceModelEnhancedConfigurationElementCollection.cs
- TreeViewCancelEvent.cs
- AutomationElementCollection.cs
- SuppressMessageAttribute.cs
- FilterQueryOptionExpression.cs
- EntityKey.cs
- BaseValidator.cs
- followingquery.cs
- StaticExtension.cs
- ResourcePool.cs
- GraphicsState.cs
- FixedTextView.cs
- SoapIncludeAttribute.cs
- SettingsPropertyValueCollection.cs
- WindowsTab.cs
- CustomAttribute.cs
- TracedNativeMethods.cs
- HtmlObjectListAdapter.cs
- SqlNode.cs
- UInt16Converter.cs
- XmlElementList.cs
- CqlErrorHelper.cs
- SoundPlayerAction.cs
- CodeTypeDeclaration.cs
- RestHandler.cs
- Camera.cs
- TextEffectResolver.cs
- VisualTreeFlattener.cs
- SvcMapFile.cs
- XmlCodeExporter.cs
- dbenumerator.cs
- C14NUtil.cs
- ArrayListCollectionBase.cs
- SoapMessage.cs
- RtfNavigator.cs
- BStrWrapper.cs
- TypeTypeConverter.cs
- AbstractSvcMapFileLoader.cs
- RadioButtonRenderer.cs
- DataTemplateSelector.cs
- FramingDecoders.cs
- RegexCapture.cs
- TableLayoutPanelCellPosition.cs
- TimeSpanValidatorAttribute.cs
- MappingSource.cs
- BitmapMetadata.cs
- AppearanceEditorPart.cs
- LinqDataSource.cs
- ActivityDesignerLayoutSerializers.cs
- SmiConnection.cs
- SimpleLine.cs
- DateTimeValueSerializer.cs
- RangeBase.cs
- LinearKeyFrames.cs
- APCustomTypeDescriptor.cs
- ReadOnlyDataSource.cs
- ActivityStatusChangeEventArgs.cs
- StyleSheetRefUrlEditor.cs
- ParseNumbers.cs
- SqlRecordBuffer.cs
- EventLogException.cs
- IpcClientManager.cs
- _LoggingObject.cs
- Array.cs
- LightweightCodeGenerator.cs
- PictureBox.cs
- Comparer.cs
- MarkupExtensionParser.cs
- ModifyActivitiesPropertyDescriptor.cs
- CharacterMetricsDictionary.cs
- HtmlLinkAdapter.cs
- ImageResources.Designer.cs
- CodeExporter.cs
- DataGridTextBoxColumn.cs
- Rfc2898DeriveBytes.cs
- ChannelAcceptor.cs
- MessageQueueInstaller.cs
- TransportContext.cs
- TextServicesCompartmentContext.cs
- BitmapInitialize.cs
- ClientFormsIdentity.cs
- TransformProviderWrapper.cs
- OleDbConnectionFactory.cs
- EntityProviderFactory.cs
- XmlnsDefinitionAttribute.cs
- MethodImplAttribute.cs
- LZCodec.cs
- Guid.cs
- DeflateStream.cs