Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- TargetConverter.cs
- BamlLocalizationDictionary.cs
- NativeMethods.cs
- StaticExtension.cs
- SafePointer.cs
- XslCompiledTransform.cs
- XmlStreamStore.cs
- WindowsListViewItem.cs
- StreamingContext.cs
- ComponentRenameEvent.cs
- DataColumnCollection.cs
- HttpFormatExtensions.cs
- AutomationEvent.cs
- BackgroundFormatInfo.cs
- SqlFactory.cs
- SystemDiagnosticsSection.cs
- DataSourceHelper.cs
- Executor.cs
- BaseCodePageEncoding.cs
- DataKey.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- Pool.cs
- SerializationObjectManager.cs
- BamlVersionHeader.cs
- Transform3DGroup.cs
- EventToken.cs
- PropertyCondition.cs
- CombinedGeometry.cs
- HttpConfigurationSystem.cs
- InProcStateClientManager.cs
- ListBox.cs
- ContentPlaceHolder.cs
- Vector3DConverter.cs
- ModelTreeEnumerator.cs
- RecognizerInfo.cs
- Figure.cs
- PerformanceCounterPermissionEntry.cs
- XmlIterators.cs
- XmlDigitalSignatureProcessor.cs
- Expressions.cs
- UniformGrid.cs
- EncoderNLS.cs
- MultipleViewPattern.cs
- ConsoleTraceListener.cs
- InstanceStore.cs
- tibetanshape.cs
- WebPartHelpVerb.cs
- DeflateStream.cs
- IdentitySection.cs
- Keywords.cs
- Popup.cs
- ValidatedMobileControlConverter.cs
- SerializationAttributes.cs
- DispatcherEventArgs.cs
- ResourceSet.cs
- FacetDescriptionElement.cs
- DesignerForm.cs
- SR.cs
- Binding.cs
- LayoutExceptionEventArgs.cs
- Base64Encoding.cs
- TextEditorLists.cs
- ColumnHeader.cs
- HMACSHA256.cs
- LexicalChunk.cs
- GeometryHitTestParameters.cs
- ObfuscateAssemblyAttribute.cs
- CngUIPolicy.cs
- TextRange.cs
- CachedPathData.cs
- TemplateFactory.cs
- IsolatedStoragePermission.cs
- ElapsedEventArgs.cs
- WebServiceMethodData.cs
- sqlser.cs
- PathFigure.cs
- EntitySqlQueryState.cs
- QilStrConcatenator.cs
- TemplatedWizardStep.cs
- VectorValueSerializer.cs
- RequestResizeEvent.cs
- QueryExecutionOption.cs
- XmlWriter.cs
- MaskDescriptor.cs
- Exception.cs
- DataBoundLiteralControl.cs
- ByteAnimationBase.cs
- TextContainerChangeEventArgs.cs
- XmlNavigatorStack.cs
- ReadOnlyDataSource.cs
- Random.cs
- Crypto.cs
- BufferedReadStream.cs
- MailSettingsSection.cs
- ViewGenerator.cs
- SqlDataSourceView.cs
- FrameworkTextComposition.cs
- DataKeyCollection.cs
- HitTestDrawingContextWalker.cs
- XmlnsDictionary.cs