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
- SystemMulticastIPAddressInformation.cs
- TemplateBindingExpressionConverter.cs
- EncodingNLS.cs
- WebFaultClientMessageInspector.cs
- UntrustedRecipientException.cs
- SAPIEngineTypes.cs
- ArgumentFixer.cs
- FilterableAttribute.cs
- WebBrowserContainer.cs
- XmlSubtreeReader.cs
- AssemblyFilter.cs
- PartialCachingControl.cs
- LinkedList.cs
- SafeLibraryHandle.cs
- SrgsDocument.cs
- DbProviderFactory.cs
- DataPager.cs
- ApplicationCommands.cs
- Zone.cs
- HttpCachePolicy.cs
- TextServicesCompartmentContext.cs
- FrugalMap.cs
- FormViewCommandEventArgs.cs
- TargetConverter.cs
- ProtocolsConfiguration.cs
- JavaScriptSerializer.cs
- RegexCaptureCollection.cs
- DataContext.cs
- EntityDescriptor.cs
- Substitution.cs
- ObjectIDGenerator.cs
- ScriptComponentDescriptor.cs
- RequestSecurityToken.cs
- ConnectionManagementElement.cs
- Lookup.cs
- RuntimeConfig.cs
- Rectangle.cs
- BlurEffect.cs
- ObjectNotFoundException.cs
- RadialGradientBrush.cs
- DetailsViewPageEventArgs.cs
- ScrollItemPatternIdentifiers.cs
- BoolExpr.cs
- MsmqMessage.cs
- AxisAngleRotation3D.cs
- FillBehavior.cs
- ResXResourceWriter.cs
- AutoResizedEvent.cs
- OleDbParameterCollection.cs
- ImageDrawing.cs
- recordstatefactory.cs
- WrappedIUnknown.cs
- FlowDocument.cs
- ImageCodecInfo.cs
- SqlCharStream.cs
- COAUTHIDENTITY.cs
- Enum.cs
- PipelineComponent.cs
- OneWayChannelFactory.cs
- DetailsViewRowCollection.cs
- ToolStripKeyboardHandlingService.cs
- TraceSection.cs
- SessionState.cs
- RadialGradientBrush.cs
- GeneralTransform3DGroup.cs
- TextModifierScope.cs
- ValidationEventArgs.cs
- HitTestWithPointDrawingContextWalker.cs
- XmlDataLoader.cs
- WebConfigurationHost.cs
- ObjectParameterCollection.cs
- ProfileSettings.cs
- HScrollBar.cs
- DataListItemCollection.cs
- ApplicationGesture.cs
- AddressHeader.cs
- SQLBytes.cs
- ContainerControl.cs
- AutomationProperty.cs
- TypeSource.cs
- CancellableEnumerable.cs
- COM2ExtendedTypeConverter.cs
- ButtonRenderer.cs
- PackWebRequestFactory.cs
- FrugalMap.cs
- Splitter.cs
- ConsoleKeyInfo.cs
- ConnectionPoint.cs
- ControlBindingsCollection.cs
- ResponseStream.cs
- StorageEntityContainerMapping.cs
- MemberDomainMap.cs
- TemplatePagerField.cs
- VectorCollection.cs
- DBCSCodePageEncoding.cs
- TextEditorSelection.cs
- AdministrationHelpers.cs
- CompiledRegexRunnerFactory.cs
- ModelVisual3D.cs
- ExpressionCopier.cs