Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Configuration / System / Configuration / ContextInformation.cs / 1 / 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
- ExpressionPrefixAttribute.cs
- CharacterString.cs
- LinqDataSourceView.cs
- GenericPrincipal.cs
- FilteredAttributeCollection.cs
- BaseCollection.cs
- WorkflowMarkupElementEventArgs.cs
- SHA256Managed.cs
- Run.cs
- SizeAnimationUsingKeyFrames.cs
- DelayedRegex.cs
- _NetRes.cs
- SamlDoNotCacheCondition.cs
- PersonalizationProvider.cs
- EntitySetBaseCollection.cs
- IIS7WorkerRequest.cs
- StylusCaptureWithinProperty.cs
- WebServiceEnumData.cs
- TimeoutTimer.cs
- WebRequestModuleElementCollection.cs
- AttributeAction.cs
- FontSource.cs
- WebPartDisplayMode.cs
- ExtractorMetadata.cs
- DateTimeConverter.cs
- LedgerEntry.cs
- IsolatedStorageFileStream.cs
- IsolatedStorage.cs
- baseaxisquery.cs
- CommandBinding.cs
- XmlSerializer.cs
- BroadcastEventHelper.cs
- RootAction.cs
- InternalBufferOverflowException.cs
- PreviewControlDesigner.cs
- WebPartVerbCollection.cs
- NTAccount.cs
- SingleConverter.cs
- shaperfactoryquerycacheentry.cs
- ScriptingWebServicesSectionGroup.cs
- Registration.cs
- ISAPIApplicationHost.cs
- GridViewActionList.cs
- XmlNamespaceDeclarationsAttribute.cs
- DataView.cs
- EntityDataSourceUtil.cs
- TreeNodeCollection.cs
- PrintEvent.cs
- KnownTypes.cs
- StoreItemCollection.cs
- ListViewSortEventArgs.cs
- SafeCryptoHandles.cs
- XPathEmptyIterator.cs
- OleDbDataReader.cs
- ConfigsHelper.cs
- XmlUnspecifiedAttribute.cs
- PolicyReader.cs
- ComplexTypeEmitter.cs
- DataBinder.cs
- ExpressionPrefixAttribute.cs
- ContentElement.cs
- TextRangeAdaptor.cs
- QueryAccessibilityHelpEvent.cs
- SafeLocalMemHandle.cs
- DesignObjectWrapper.cs
- BuildResult.cs
- Instrumentation.cs
- Int32Converter.cs
- SqlBulkCopy.cs
- WinEventQueueItem.cs
- Maps.cs
- DataColumnCollection.cs
- ComplexTypeEmitter.cs
- BaseCodePageEncoding.cs
- CharacterBuffer.cs
- TraceContextEventArgs.cs
- TextDecorationLocationValidation.cs
- ObjectConverter.cs
- FixedLineResult.cs
- DataGridViewButtonColumn.cs
- SmiMetaData.cs
- StylusButtonEventArgs.cs
- MarkerProperties.cs
- WindowsToolbarAsMenu.cs
- HostingEnvironment.cs
- WebPartDisplayModeCancelEventArgs.cs
- RawStylusInputReport.cs
- _AcceptOverlappedAsyncResult.cs
- ParameterReplacerVisitor.cs
- XmlSchemaSimpleTypeRestriction.cs
- ToolStripDropDownButton.cs
- CodeTypeReferenceCollection.cs
- NameHandler.cs
- LinqDataSourceContextData.cs
- DetailsViewPagerRow.cs
- LocatorPart.cs
- SecuritySessionSecurityTokenProvider.cs
- XmlPropertyBag.cs
- DocumentAutomationPeer.cs
- EntityContainerAssociationSet.cs