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
- HMACRIPEMD160.cs
- HotCommands.cs
- Rotation3D.cs
- ProjectionPath.cs
- DetailsViewInsertedEventArgs.cs
- ConstraintStruct.cs
- Utility.cs
- ColumnHeaderCollectionEditor.cs
- XXXOnTypeBuilderInstantiation.cs
- MediaEntryAttribute.cs
- RuleAction.cs
- remotingproxy.cs
- GridItemCollection.cs
- DateTimeConstantAttribute.cs
- SqlInfoMessageEvent.cs
- AssemblyBuilder.cs
- ClientOptions.cs
- CodeDomExtensionMethods.cs
- Vector3D.cs
- FixedSOMLineCollection.cs
- XmlQueryContext.cs
- SqlConnectionString.cs
- Input.cs
- InfoCardClaim.cs
- Registry.cs
- WebPartTransformerCollection.cs
- TemplatePartAttribute.cs
- DrawingGroupDrawingContext.cs
- BehaviorService.cs
- MediaContextNotificationWindow.cs
- CapabilitiesState.cs
- FactoryMaker.cs
- PiiTraceSource.cs
- TakeQueryOptionExpression.cs
- KeyValueSerializer.cs
- EntityContainer.cs
- RSAOAEPKeyExchangeDeformatter.cs
- SiteOfOriginPart.cs
- BitSet.cs
- AppSettingsReader.cs
- BuildResult.cs
- CellParaClient.cs
- PrtCap_Reader.cs
- SplashScreen.cs
- SqlInternalConnectionTds.cs
- ByteStreamGeometryContext.cs
- FolderBrowserDialogDesigner.cs
- XPathEmptyIterator.cs
- SHA512.cs
- XmlSchemaCompilationSettings.cs
- NavigationProgressEventArgs.cs
- AutomationProperty.cs
- ParameterCollection.cs
- BitmapCodecInfoInternal.cs
- TextEffectResolver.cs
- ScriptResourceAttribute.cs
- GenericWebPart.cs
- EventProxy.cs
- XmlAnyAttributeAttribute.cs
- FileFormatException.cs
- ManipulationLogic.cs
- ServicePoint.cs
- JoinTreeSlot.cs
- SecurityStateEncoder.cs
- FileDialogCustomPlace.cs
- EncoderFallback.cs
- ToolStripItem.cs
- NamespaceInfo.cs
- EDesignUtil.cs
- ConnectionStringsExpressionBuilder.cs
- Literal.cs
- NativeMethods.cs
- MenuItem.cs
- SQLInt16.cs
- RuleDefinitions.cs
- XmlAnyElementAttribute.cs
- TrackingMemoryStreamFactory.cs
- BaseHashHelper.cs
- RichTextBoxDesigner.cs
- SelectionEditor.cs
- Merger.cs
- RtType.cs
- XmlDataSourceView.cs
- SoapSchemaMember.cs
- MobileControlDesigner.cs
- Point4D.cs
- MouseButton.cs
- EdmComplexTypeAttribute.cs
- X509RecipientCertificateServiceElement.cs
- ToolboxComponentsCreatedEventArgs.cs
- PropertyEmitter.cs
- SectionXmlInfo.cs
- BlurEffect.cs
- OleDbEnumerator.cs
- TableLayoutStyle.cs
- EmissiveMaterial.cs
- KeyboardNavigation.cs
- FocusChangedEventArgs.cs
- UserUseLicenseDictionaryLoader.cs
- HttpResponseInternalWrapper.cs