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
- TextEditorLists.cs
- HtmlShimManager.cs
- XmlCDATASection.cs
- DataServiceProviderMethods.cs
- AccessedThroughPropertyAttribute.cs
- HuffCodec.cs
- StaticContext.cs
- EdmPropertyAttribute.cs
- NavigationCommands.cs
- ListViewDeletedEventArgs.cs
- MulticastDelegate.cs
- MimeObjectFactory.cs
- InvalidProgramException.cs
- ImportException.cs
- JournalEntryListConverter.cs
- TextTreeInsertUndoUnit.cs
- HtmlElementEventArgs.cs
- TableStyle.cs
- FormsAuthenticationTicket.cs
- TokenCreationException.cs
- LookupBindingPropertiesAttribute.cs
- sitestring.cs
- WebPartCollection.cs
- PhysicalAddress.cs
- DataGridViewAccessibleObject.cs
- Cursor.cs
- DataRecordInternal.cs
- FloaterParaClient.cs
- Helper.cs
- ServiceOperationListItemList.cs
- FastEncoderWindow.cs
- Brushes.cs
- Point3DAnimationUsingKeyFrames.cs
- BitmapEffect.cs
- TypeUsageBuilder.cs
- AppliedDeviceFiltersDialog.cs
- ScriptControl.cs
- CopyAttributesAction.cs
- PointLight.cs
- WebPartUtil.cs
- Vector3DKeyFrameCollection.cs
- GeometryHitTestParameters.cs
- TextEditorParagraphs.cs
- ZoneLinkButton.cs
- GridPatternIdentifiers.cs
- CheckBoxField.cs
- XmlSiteMapProvider.cs
- EditCommandColumn.cs
- IndependentlyAnimatedPropertyMetadata.cs
- PictureBoxDesigner.cs
- WebPartEventArgs.cs
- RemotingException.cs
- ScriptBehaviorDescriptor.cs
- Attributes.cs
- ImageDrawing.cs
- RadioButtonFlatAdapter.cs
- UndirectedGraph.cs
- DesignTimeTemplateParser.cs
- XPathDocumentBuilder.cs
- ByteStream.cs
- InputScope.cs
- TrustManager.cs
- SettingsAttributeDictionary.cs
- StrongTypingException.cs
- SmtpNegotiateAuthenticationModule.cs
- ErrorFormatter.cs
- xmlformatgeneratorstatics.cs
- SchemaNotation.cs
- BooleanExpr.cs
- basecomparevalidator.cs
- SafeNativeMethods.cs
- Variant.cs
- SqlXml.cs
- DataBindingCollection.cs
- EntityDataSourceWrapper.cs
- TransformDescriptor.cs
- RepeatBehaviorConverter.cs
- Debug.cs
- SemaphoreFullException.cs
- BuildDependencySet.cs
- IndexedGlyphRun.cs
- DbLambda.cs
- Page.cs
- Storyboard.cs
- XmlDataCollection.cs
- SqlFlattener.cs
- SafeNativeMethodsMilCoreApi.cs
- StringBuilder.cs
- RowToFieldTransformer.cs
- HitTestWithPointDrawingContextWalker.cs
- ServerReliableChannelBinder.cs
- PenContext.cs
- CTreeGenerator.cs
- Opcode.cs
- BitStream.cs
- BitmapDecoder.cs
- WebPartDeleteVerb.cs
- NamedPipeProcessProtocolHandler.cs
- WebPartManagerInternals.cs
- EncoderNLS.cs