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
- ObjectDataSource.cs
- XhtmlConformanceSection.cs
- StringFreezingAttribute.cs
- TdsRecordBufferSetter.cs
- SafeArrayTypeMismatchException.cs
- DescriptionAttribute.cs
- ColorInterpolationModeValidation.cs
- ExecutedRoutedEventArgs.cs
- DesignerAttribute.cs
- SystemTcpConnection.cs
- ToolStripItem.cs
- ControlValuePropertyAttribute.cs
- SizeConverter.cs
- SchemaCreator.cs
- SpecialFolderEnumConverter.cs
- CmsInterop.cs
- DataGridViewCheckBoxColumn.cs
- JumpTask.cs
- CatalogZoneBase.cs
- DataServiceResponse.cs
- VirtualizingPanel.cs
- ThemeDirectoryCompiler.cs
- BigIntegerStorage.cs
- EUCJPEncoding.cs
- RegionIterator.cs
- ProtocolException.cs
- SiteMapNodeItem.cs
- EtwTrace.cs
- DataGridViewToolTip.cs
- CodeNamespace.cs
- WindowsStreamSecurityUpgradeProvider.cs
- SmiGettersStream.cs
- PropertyKey.cs
- XmlWhitespace.cs
- EncoderNLS.cs
- XamlFxTrace.cs
- SqlDataSource.cs
- FixedPageProcessor.cs
- QuaternionRotation3D.cs
- DataGridViewIntLinkedList.cs
- TypeGenericEnumerableViewSchema.cs
- LocatorPart.cs
- ResourceDictionary.cs
- TemplateControlCodeDomTreeGenerator.cs
- SqlRecordBuffer.cs
- ModuleConfigurationInfo.cs
- BaseProcessor.cs
- EmptyCollection.cs
- Brush.cs
- AdornerPresentationContext.cs
- RestHandlerFactory.cs
- PerformanceCounterPermissionAttribute.cs
- CategoryNameCollection.cs
- Application.cs
- BindStream.cs
- MetadataUtil.cs
- DetailsViewModeEventArgs.cs
- TextElementAutomationPeer.cs
- Material.cs
- Matrix3D.cs
- ConfigurationManagerInternal.cs
- ColumnMap.cs
- ThemeInfoAttribute.cs
- TraceUtility.cs
- CodeCompileUnit.cs
- X509CertificateTrustedIssuerElement.cs
- formatter.cs
- InterleavedZipPartStream.cs
- HtmlLiteralTextAdapter.cs
- SemanticResolver.cs
- TargetParameterCountException.cs
- ChannelCacheSettings.cs
- ComUdtElement.cs
- TransactionContextManager.cs
- ApplicationException.cs
- StorageBasedPackageProperties.cs
- MimeMapping.cs
- UncommonField.cs
- XdrBuilder.cs
- QueryCacheKey.cs
- ByteAnimationBase.cs
- StylusSystemGestureEventArgs.cs
- DbConvert.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- IdentityModelDictionary.cs
- LogRestartAreaEnumerator.cs
- SecUtil.cs
- ServicesUtilities.cs
- UnsafeNativeMethods.cs
- RequestCacheEntry.cs
- ValidationPropertyAttribute.cs
- ClonableStack.cs
- PanelStyle.cs
- RuleConditionDialog.Designer.cs
- ResolvedKeyFrameEntry.cs
- DWriteFactory.cs
- EventSetter.cs
- XamlWrappingReader.cs
- StrongNameIdentityPermission.cs