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
- SequenceDesigner.cs
- LightweightEntityWrapper.cs
- DocumentDesigner.cs
- MetaModel.cs
- SeverityFilter.cs
- Security.cs
- SqlStatistics.cs
- PeerChannelListener.cs
- CodeSnippetExpression.cs
- MailMessage.cs
- sqlpipe.cs
- Latin1Encoding.cs
- IntegerFacetDescriptionElement.cs
- PathGeometry.cs
- EnvelopeVersion.cs
- InkCanvas.cs
- ToolStripLabel.cs
- OpCellTreeNode.cs
- RegexCode.cs
- ButtonBaseAdapter.cs
- OutputCacheProfileCollection.cs
- LinkTarget.cs
- TypeGeneratedEventArgs.cs
- Separator.cs
- followingquery.cs
- InvokePatternIdentifiers.cs
- PowerStatus.cs
- HostingEnvironmentSection.cs
- EntityTransaction.cs
- XmlLinkedNode.cs
- BaseAsyncResult.cs
- DataServiceClientException.cs
- DrawingCollection.cs
- SqlResolver.cs
- LinkClickEvent.cs
- XmlSchemaExternal.cs
- AmbientValueAttribute.cs
- ModuleConfigurationInfo.cs
- SspiNegotiationTokenProvider.cs
- SequenceFullException.cs
- MenuItemStyle.cs
- _WinHttpWebProxyDataBuilder.cs
- ObjectView.cs
- ListBoxItemWrapperAutomationPeer.cs
- RadioButton.cs
- RtfControlWordInfo.cs
- ValidationErrorCollection.cs
- DelegateArgument.cs
- LogWriteRestartAreaState.cs
- InternalConfigRoot.cs
- ViewBox.cs
- X509Utils.cs
- DBConnection.cs
- RunInstallerAttribute.cs
- MultiPropertyDescriptorGridEntry.cs
- StatusBarDrawItemEvent.cs
- ReceiveContent.cs
- TogglePatternIdentifiers.cs
- DetailsViewInsertedEventArgs.cs
- DbModificationCommandTree.cs
- PrintDialog.cs
- ApplicationTrust.cs
- EntityReference.cs
- ResourceAttributes.cs
- IisTraceWebEventProvider.cs
- XPathConvert.cs
- ImmComposition.cs
- HttpCapabilitiesSectionHandler.cs
- TcpAppDomainProtocolHandler.cs
- InputDevice.cs
- OdbcTransaction.cs
- XmlArrayAttribute.cs
- DiffuseMaterial.cs
- OdbcFactory.cs
- NativeWindow.cs
- CodeSubDirectoriesCollection.cs
- EmptyTextWriter.cs
- WebPartConnectionsCloseVerb.cs
- ServiceManager.cs
- DataBindEngine.cs
- RecognizedWordUnit.cs
- ListView.cs
- AutoResetEvent.cs
- BamlBinaryWriter.cs
- StringUtil.cs
- DotExpr.cs
- MonikerProxyAttribute.cs
- BinaryNode.cs
- SchemaInfo.cs
- GeneralTransform3DGroup.cs
- RegisteredExpandoAttribute.cs
- HwndSourceKeyboardInputSite.cs
- GeometryDrawing.cs
- BinaryMethodMessage.cs
- CodeSnippetExpression.cs
- ResourceProviderFactory.cs
- XmlDocumentSchema.cs
- ManualResetEvent.cs
- HttpWebRequestElement.cs
- AnimationLayer.cs