Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Tools / xws_reg / System / ServiceModel / Install / Configuration / ConfigurationLoader.cs / 1 / ConfigurationLoader.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Install.Configuration { using WebAdmin = Microsoft.Web.Administration; using System; using System.ServiceModel; using System.Configuration; using System.ServiceModel.Configuration; using System.Web.Configuration; using System.Xml; internal abstract class ConfigurationLoader { protected Configuration machineConfiguration; protected Configuration rootWebConfiguration; internal abstract Configuration MachineConfiguration { get; } internal string MachineConfigurationFilePath { get { string filePath = null; if (null != this.MachineConfiguration) { filePath = this.MachineConfiguration.FilePath; } return filePath; } } internal abstract Configuration RootWebConfiguration { get; } internal string RootWebConfigurationFilePath { get { string filePath = null; if (null != this.RootWebConfiguration) { filePath = this.RootWebConfiguration.FilePath; } return filePath; } } internal ProtocolsSection ProtocolsSection { get { return (ProtocolsSection)this.RootWebConfiguration.GetSection(this.ProtocolsSectionPath); } } internal string ProtocolsSectionPath { get { return "system.web/protocols"; } } internal ServiceHostingEnvironmentSection ServiceHostingEnvironmentSection { get { return (ServiceHostingEnvironmentSection)this.RootWebConfiguration.GetSection(this.ServiceHostingEnvironmentSectionPath); } } internal string ServiceHostingEnvironmentSectionPath { get { return "system.serviceModel/serviceHostingEnvironment"; } } internal SystemWebSectionGroup SystemWebSectionGroup { get { return (SystemWebSectionGroup)this.RootWebConfiguration.GetSectionGroup(this.SystemWebSectionGroupPath); } } internal string SystemWebSectionGroupPath { get { return "system.web"; } } internal bool RemoveNodeFromConfigFile(string configFilePath, string xpath, bool ifNodeIsEmpty) { bool retVal = false; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(configFilePath); XmlNode node = xmlDoc.SelectSingleNode(xpath); if (null != node) { if (ifNodeIsEmpty) { if (0 == node.Attributes.Count && !node.HasChildNodes) { node.ParentNode.RemoveChild(node); retVal = true; } } else { node.ParentNode.RemoveChild(node); retVal = true; } } if (retVal) { xmlDoc.Save(configFilePath); if (configFilePath.Equals(this.MachineConfigurationFilePath, StringComparison.OrdinalIgnoreCase)) { this.machineConfiguration = null; } else if (configFilePath.Equals(this.RootWebConfigurationFilePath, StringComparison.OrdinalIgnoreCase)) { this.rootWebConfiguration = null; } } return retVal; } internal virtual void Save() { if (null != this.machineConfiguration) { this.machineConfiguration.Save(); this.machineConfiguration = null; } if (null != this.rootWebConfiguration) { this.rootWebConfiguration.Save(); this.rootWebConfiguration = null; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlObjectSerializerReadContext.cs
- StorageInfo.cs
- WebPart.cs
- coordinator.cs
- ScrollViewer.cs
- FixedDocument.cs
- ImageListStreamer.cs
- ImagingCache.cs
- VarRefManager.cs
- ListViewItemCollectionEditor.cs
- ResourcesChangeInfo.cs
- DictionaryContent.cs
- TextReader.cs
- SqlIdentifier.cs
- InternalConfirm.cs
- _ProxyChain.cs
- XamlReaderConstants.cs
- StringFunctions.cs
- Parsers.cs
- ProviderUtil.cs
- NativeBuffer.cs
- BufferAllocator.cs
- ScrollBarRenderer.cs
- OrthographicCamera.cs
- ImpersonateTokenRef.cs
- Debug.cs
- BooleanConverter.cs
- FormCollection.cs
- ChildTable.cs
- TransformCryptoHandle.cs
- BaseResourcesBuildProvider.cs
- FixedSOMSemanticBox.cs
- __FastResourceComparer.cs
- DataGridViewCellMouseEventArgs.cs
- ArgumentException.cs
- MachineSettingsSection.cs
- ProvidersHelper.cs
- TrustSection.cs
- RadioButtonAutomationPeer.cs
- OutputScopeManager.cs
- ObjectIDGenerator.cs
- GeneralTransformGroup.cs
- MonthChangedEventArgs.cs
- DivideByZeroException.cs
- ResourcePermissionBaseEntry.cs
- ArcSegment.cs
- LostFocusEventManager.cs
- ComboBoxAutomationPeer.cs
- HtmlInputCheckBox.cs
- FrameworkContentElement.cs
- ClientSponsor.cs
- ToolStripComboBox.cs
- Matrix.cs
- NumberFormatInfo.cs
- DataTableExtensions.cs
- FileSystemWatcher.cs
- MulticastNotSupportedException.cs
- RouteItem.cs
- UserValidatedEventArgs.cs
- Misc.cs
- GZipDecoder.cs
- CommandManager.cs
- SafePEFileHandle.cs
- RewritingValidator.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- BindingMemberInfo.cs
- FontFaceLayoutInfo.cs
- AnnotationAdorner.cs
- ProjectionRewriter.cs
- SQLByte.cs
- IgnoreSectionHandler.cs
- SimpleLine.cs
- DataColumnMappingCollection.cs
- SslStream.cs
- MaskedTextBox.cs
- XmlElement.cs
- Wizard.cs
- CustomCategoryAttribute.cs
- GridViewDeleteEventArgs.cs
- CapabilitiesSection.cs
- MessageSecurityProtocolFactory.cs
- ErrorTableItemStyle.cs
- XmlTypeMapping.cs
- SqlCharStream.cs
- HttpServerChannel.cs
- GenerateScriptTypeAttribute.cs
- LinkArea.cs
- Model3D.cs
- StreamedWorkflowDefinitionContext.cs
- SqlMethods.cs
- AutomationPattern.cs
- DefaultTextStore.cs
- RootBrowserWindowAutomationPeer.cs
- PersistenceException.cs
- ReaderWriterLockWrapper.cs
- InstanceKey.cs
- CancellationTokenSource.cs
- LoginUtil.cs
- SmiTypedGetterSetter.cs
- TimeSpanMinutesConverter.cs