Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CheckBox.cs
- WorkflowMarkupSerializationException.cs
- XPathBuilder.cs
- PropertyGeneratedEventArgs.cs
- StorageAssociationSetMapping.cs
- Stackframe.cs
- PasswordBoxAutomationPeer.cs
- EntityStoreSchemaFilterEntry.cs
- File.cs
- Queue.cs
- MethodBody.cs
- IisTraceWebEventProvider.cs
- HtmlControlPersistable.cs
- TextEditorThreadLocalStore.cs
- CodeDirectoryCompiler.cs
- RsaElement.cs
- MD5Cng.cs
- PolyQuadraticBezierSegment.cs
- TreeNodeCollectionEditorDialog.cs
- CroppedBitmap.cs
- DataGridViewCellStyleChangedEventArgs.cs
- DataPagerField.cs
- TypeSystem.cs
- AlignmentYValidation.cs
- ApplicationManager.cs
- SchemaType.cs
- IntSecurity.cs
- OperationCanceledException.cs
- FactoryMaker.cs
- ContractMapping.cs
- RuntimeArgumentHandle.cs
- AnnotationService.cs
- EntityKeyElement.cs
- StronglyTypedResourceBuilder.cs
- Peer.cs
- util.cs
- XmlArrayAttribute.cs
- FontConverter.cs
- TransformValueSerializer.cs
- DigestComparer.cs
- CodeDefaultValueExpression.cs
- ILGenerator.cs
- CompilerTypeWithParams.cs
- Parameter.cs
- Environment.cs
- MultiPropertyDescriptorGridEntry.cs
- CharacterMetrics.cs
- PropertyEmitter.cs
- BrowserCapabilitiesCodeGenerator.cs
- TextEditorTables.cs
- FlowDocumentFormatter.cs
- BrowserCapabilitiesFactoryBase.cs
- OrderedHashRepartitionEnumerator.cs
- HtmlAnchor.cs
- VisualTreeHelper.cs
- AvtEvent.cs
- ComponentDispatcher.cs
- WebPartConnection.cs
- SecurityUtils.cs
- TextDocumentView.cs
- XmlNamedNodeMap.cs
- InvalidateEvent.cs
- DataTableReader.cs
- NumberSubstitution.cs
- MetabaseReader.cs
- RoutingService.cs
- EntityKey.cs
- TrackingRecordPreFilter.cs
- IteratorFilter.cs
- KeysConverter.cs
- DataColumnSelectionConverter.cs
- XmlQueryContext.cs
- X509WindowsSecurityToken.cs
- CellParagraph.cs
- MailSettingsSection.cs
- AdornerDecorator.cs
- CodeTypeDeclaration.cs
- IgnoreSectionHandler.cs
- MultiAsyncResult.cs
- DoubleLinkList.cs
- ProgressBar.cs
- dtdvalidator.cs
- RedistVersionInfo.cs
- DataGridViewUtilities.cs
- SamlAudienceRestrictionCondition.cs
- QilXmlWriter.cs
- DataServiceProcessingPipelineEventArgs.cs
- ElapsedEventArgs.cs
- ComboBox.cs
- BitmapEffectDrawing.cs
- WebPartEditorOkVerb.cs
- IisTraceWebEventProvider.cs
- BitmapEffectInput.cs
- sqlstateclientmanager.cs
- TransformerInfoCollection.cs
- BinaryFormatter.cs
- MeasureData.cs
- PackageRelationshipCollection.cs
- IntMinMaxAggregationOperator.cs
- ColorTransform.cs