Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- TTSEngineTypes.cs
- ErrorWebPart.cs
- HtmlWindowCollection.cs
- DashStyle.cs
- ToolStripRenderEventArgs.cs
- CreateUserWizardStep.cs
- XmlWrappingReader.cs
- ThicknessConverter.cs
- AudioFileOut.cs
- ToolStripButton.cs
- CacheHelper.cs
- ParserHooks.cs
- SqlTrackingService.cs
- PasswordBox.cs
- LoginUtil.cs
- SmtpNegotiateAuthenticationModule.cs
- MyContact.cs
- Viewport3DAutomationPeer.cs
- ExtendedPropertyCollection.cs
- SQLBinary.cs
- DataGridViewRowConverter.cs
- CheckBox.cs
- ResourceDictionaryCollection.cs
- TriggerCollection.cs
- AnnotationDocumentPaginator.cs
- ChangeTracker.cs
- RsaKeyIdentifierClause.cs
- BasicHttpBindingElement.cs
- ColorConvertedBitmapExtension.cs
- IncrementalReadDecoders.cs
- AsymmetricKeyExchangeDeformatter.cs
- SmtpAuthenticationManager.cs
- Cursors.cs
- DeobfuscatingStream.cs
- DesignTimeData.cs
- PerfCounters.cs
- StatusBarPanelClickEvent.cs
- SystemParameters.cs
- DeleteBookmarkScope.cs
- GeometryValueSerializer.cs
- PageRanges.cs
- documentsequencetextcontainer.cs
- Timer.cs
- FromRequest.cs
- Profiler.cs
- XmlEntity.cs
- WebFormsRootDesigner.cs
- EventLogPermissionEntry.cs
- CodePrimitiveExpression.cs
- WindowsSpinner.cs
- _DigestClient.cs
- ResourceManagerWrapper.cs
- WinEventTracker.cs
- AssemblyUtil.cs
- GrammarBuilderBase.cs
- MergeFailedEvent.cs
- HttpStaticObjectsCollectionWrapper.cs
- MethodBuilder.cs
- Bidi.cs
- AttributeQuery.cs
- ZipIOLocalFileHeader.cs
- DbDataAdapter.cs
- SemanticBasicElement.cs
- MessageContractAttribute.cs
- DataGridCommandEventArgs.cs
- RegisteredArrayDeclaration.cs
- NegotiationTokenProvider.cs
- SQLDoubleStorage.cs
- SecurityRuntime.cs
- XmlNodeChangedEventArgs.cs
- NativeObjectSecurity.cs
- XmlChildNodes.cs
- CodeIdentifiers.cs
- TemplateControlParser.cs
- Span.cs
- Decimal.cs
- DataGridPageChangedEventArgs.cs
- IncrementalHitTester.cs
- DetailsViewRow.cs
- unsafenativemethodsother.cs
- BoundField.cs
- RegexMatch.cs
- SystemIcons.cs
- AuthenticationSection.cs
- XmlMembersMapping.cs
- PenCursorManager.cs
- XhtmlBasicTextBoxAdapter.cs
- CustomErrorsSection.cs
- ReceiveErrorHandling.cs
- WebAdminConfigurationHelper.cs
- SerialErrors.cs
- MeasurementDCInfo.cs
- TagPrefixCollection.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- RequestQueryProcessor.cs
- MobileCapabilities.cs
- UIElementIsland.cs
- SQLInt64.cs
- ZipIOLocalFileDataDescriptor.cs
- TemplateBuilder.cs