Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Nullable.cs
- HtmlContainerControl.cs
- XamlTemplateSerializer.cs
- CapabilitiesPattern.cs
- FrameworkContentElement.cs
- PageFunction.cs
- InternalCache.cs
- WSSecurityPolicy12.cs
- StorageEntityContainerMapping.cs
- MD5CryptoServiceProvider.cs
- ContextMenuStripGroup.cs
- GrammarBuilderPhrase.cs
- IDReferencePropertyAttribute.cs
- ContainerSelectorBehavior.cs
- Command.cs
- EntityDataSourceQueryBuilder.cs
- Point4DConverter.cs
- ForwardPositionQuery.cs
- IncrementalHitTester.cs
- TextEffect.cs
- Hash.cs
- XmlResolver.cs
- HttpRuntimeSection.cs
- WebSysDescriptionAttribute.cs
- DataControlField.cs
- ValidationHelpers.cs
- EncodingInfo.cs
- NameValueFileSectionHandler.cs
- SerializationInfoEnumerator.cs
- ColorTransform.cs
- SystemColors.cs
- controlskin.cs
- RadioButtonRenderer.cs
- WorkflowInstanceExtensionManager.cs
- ServicePoint.cs
- DataGridHeaderBorder.cs
- InputLangChangeEvent.cs
- GuidConverter.cs
- DataRowExtensions.cs
- CodeTypeConstructor.cs
- XsltException.cs
- StyleBamlRecordReader.cs
- SID.cs
- InternalBase.cs
- SqlStatistics.cs
- SynchronizedChannelCollection.cs
- WebBrowserContainer.cs
- LocatorGroup.cs
- DataError.cs
- BuildProviderAppliesToAttribute.cs
- DefaultIfEmptyQueryOperator.cs
- SupportingTokenAuthenticatorSpecification.cs
- SqlAliasesReferenced.cs
- SizeKeyFrameCollection.cs
- CalendarData.cs
- PropertyDescriptor.cs
- StreamInfo.cs
- ThemeInfoAttribute.cs
- HtmlButton.cs
- XslVisitor.cs
- SrgsToken.cs
- ControlCollection.cs
- CqlLexerHelpers.cs
- NullRuntimeConfig.cs
- FaultBookmark.cs
- documentsequencetextcontainer.cs
- SignedPkcs7.cs
- UniqueConstraint.cs
- TextSearch.cs
- OracleParameterBinding.cs
- HtmlTitle.cs
- OleDbPermission.cs
- StyleBamlTreeBuilder.cs
- ArrayConverter.cs
- SHA1.cs
- CodeIndexerExpression.cs
- HorizontalAlignConverter.cs
- LineSegment.cs
- Vector3DValueSerializer.cs
- DataGridViewColumnCollection.cs
- FixedDocument.cs
- CorrelationKey.cs
- RenderingEventArgs.cs
- SynchronousChannelMergeEnumerator.cs
- FunctionUpdateCommand.cs
- Substitution.cs
- EnumDataContract.cs
- ParenExpr.cs
- ComponentEditorPage.cs
- NameGenerator.cs
- WindowAutomationPeer.cs
- TemplateBindingExtension.cs
- ExceptionRoutedEventArgs.cs
- XmlQueryTypeFactory.cs
- DataObjectSettingDataEventArgs.cs
- Column.cs
- DataGridPagerStyle.cs
- DataKey.cs
- RequestCache.cs
- MetricEntry.cs