Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / ServiceModelEnhancedConfigurationElementCollection.cs / 1 / ServiceModelEnhancedConfigurationElementCollection.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System.Configuration; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.ServiceModel.Diagnostics; public abstract class ServiceModelEnhancedConfigurationElementCollection: ServiceModelConfigurationElementCollection where TConfigurationElement : ConfigurationElement, new() { internal ServiceModelEnhancedConfigurationElementCollection(string elementName) : base(ConfigurationElementCollectionType.AddRemoveClearMap, elementName) { this.AddElementName = elementName; } protected override void BaseAdd(ConfigurationElement element) { if (null == element) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } // Is this a duplicate key? object newElementKey = this.GetElementKey(element); if (this.ContainsKey(newElementKey)) { ConfigurationElement oldElement = this.BaseGet(newElementKey); if (null != oldElement) { // Is oldElement present in the current level of config // being manipulated (i.e. duplicate in same config file) if (oldElement.ElementInformation.IsPresent) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.ConfigDuplicateKeyAtSameScope, this.ElementName, newElementKey))); } else if (DiagnosticUtility.ShouldTraceWarning) { Dictionary values = new Dictionary (6); values.Add("ElementName", this.ElementName); values.Add("Name", newElementKey.ToString()); values.Add("OldElementLocation", oldElement.ElementInformation.Source); values.Add("OldElementLineNumber", oldElement.ElementInformation.LineNumber.ToString(NumberFormatInfo.CurrentInfo)); values.Add("NewElementLocation", element.ElementInformation.Source); values.Add("NewElementLineNumber", element.ElementInformation.LineNumber.ToString(NumberFormatInfo.CurrentInfo)); DictionaryTraceRecord traceRecord = new DictionaryTraceRecord(values); TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.OverridingDuplicateConfigurationKey, traceRecord, this, null); } } } base.BaseAdd(element); } protected override bool ThrowOnDuplicate { get { return false; } } } } // 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
- InfiniteTimeSpanConverter.cs
- XamlLoadErrorInfo.cs
- HistoryEventArgs.cs
- safemediahandle.cs
- Matrix3DStack.cs
- ResXResourceReader.cs
- MailMessage.cs
- MethodBuilder.cs
- ConfigXmlSignificantWhitespace.cs
- IxmlLineInfo.cs
- ColumnCollection.cs
- CapabilitiesRule.cs
- PackWebRequest.cs
- FloaterBaseParagraph.cs
- HttpCacheParams.cs
- OleDbCommand.cs
- ExpressionBuilderCollection.cs
- DecimalConstantAttribute.cs
- TraceHandler.cs
- SQLString.cs
- CompilerParameters.cs
- FrameworkPropertyMetadata.cs
- XmlElementAttributes.cs
- TargetPerspective.cs
- DiagnosticTrace.cs
- Transactions.cs
- MethodBuilderInstantiation.cs
- FontUnit.cs
- NetworkInformationException.cs
- WCFServiceClientProxyGenerator.cs
- AuthenticationService.cs
- PbrsForward.cs
- BatchParser.cs
- DynamicMethod.cs
- KeyValueConfigurationElement.cs
- ParserOptions.cs
- ActivityExecutorSurrogate.cs
- Token.cs
- ParserOptions.cs
- Point3DAnimationUsingKeyFrames.cs
- SystemTcpStatistics.cs
- GenericParameterDataContract.cs
- ZipFileInfo.cs
- AdRotator.cs
- OleDbDataReader.cs
- XmlMapping.cs
- StylusLogic.cs
- HandleCollector.cs
- TrackPointCollection.cs
- FindCompletedEventArgs.cs
- SByteConverter.cs
- WebPermission.cs
- CopyCodeAction.cs
- DialogResultConverter.cs
- DataBoundControlHelper.cs
- DataComponentMethodGenerator.cs
- DataKey.cs
- BinHexEncoding.cs
- SoapCodeExporter.cs
- Ray3DHitTestResult.cs
- InitializationEventAttribute.cs
- OdbcFactory.cs
- ScriptingRoleServiceSection.cs
- InternalConfigRoot.cs
- XmlByteStreamWriter.cs
- UnsettableComboBox.cs
- CanExecuteRoutedEventArgs.cs
- NegotiateStream.cs
- EventLog.cs
- ListViewDeleteEventArgs.cs
- DictionaryItemsCollection.cs
- TextElementEnumerator.cs
- UnmanagedHandle.cs
- DataBindingHandlerAttribute.cs
- DrawingGroup.cs
- WmpBitmapDecoder.cs
- ConsoleEntryPoint.cs
- WCFModelStrings.Designer.cs
- ErrorEventArgs.cs
- UnsafeNativeMethodsMilCoreApi.cs
- StylusButtonEventArgs.cs
- InputBuffer.cs
- Token.cs
- SynchronousChannel.cs
- CompiledQuery.cs
- MarkupWriter.cs
- ClientBuildManagerCallback.cs
- UIServiceHelper.cs
- VariableQuery.cs
- RegexCaptureCollection.cs
- AnnotationDocumentPaginator.cs
- CardSpaceException.cs
- QueryableDataSource.cs
- RenderingEventArgs.cs
- BooleanStorage.cs
- MenuItemBinding.cs
- AdapterUtil.cs
- AttributeCollection.cs
- DatasetMethodGenerator.cs
- ListViewAutomationPeer.cs