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
- TagMapCollection.cs
- NotificationContext.cs
- DataServiceQueryException.cs
- ToolTip.cs
- Calendar.cs
- Matrix3D.cs
- SmtpReplyReaderFactory.cs
- UnicastIPAddressInformationCollection.cs
- DragStartedEventArgs.cs
- ThreadStateException.cs
- SQLCharsStorage.cs
- GeneralTransform3D.cs
- BindingGroup.cs
- TemplateKey.cs
- BatchWriter.cs
- Table.cs
- Normalization.cs
- SeekStoryboard.cs
- StrokeFIndices.cs
- SchemaNamespaceManager.cs
- SslStreamSecurityBindingElement.cs
- ConstructorNeedsTagAttribute.cs
- PieceNameHelper.cs
- LongValidator.cs
- WindowHideOrCloseTracker.cs
- IISUnsafeMethods.cs
- DesignerProperties.cs
- UIElement.cs
- SerTrace.cs
- IntermediatePolicyValidator.cs
- ListView.cs
- ParameterModifier.cs
- TextFormatterContext.cs
- BaseTemplateCodeDomTreeGenerator.cs
- FilterQueryOptionExpression.cs
- unsafenativemethodstextservices.cs
- TargetControlTypeCache.cs
- TreeViewImageIndexConverter.cs
- XamlTypeMapper.cs
- FontSource.cs
- TextureBrush.cs
- IPAddress.cs
- FolderLevelBuildProvider.cs
- ClientConfigurationHost.cs
- CodeMemberProperty.cs
- HtmlDocument.cs
- TreeNodeConverter.cs
- SecurityHelper.cs
- VariantWrapper.cs
- PreProcessInputEventArgs.cs
- SqlTypesSchemaImporter.cs
- DecimalConverter.cs
- InstanceView.cs
- WmfPlaceableFileHeader.cs
- XmlnsPrefixAttribute.cs
- OptimizedTemplateContent.cs
- FragmentNavigationEventArgs.cs
- WindowsGrip.cs
- UInt32Storage.cs
- EncryptedData.cs
- X500Name.cs
- CryptographicAttribute.cs
- SemanticResolver.cs
- TextViewBase.cs
- Pair.cs
- SslStreamSecurityUpgradeProvider.cs
- TdsParserStateObject.cs
- TemplateControlBuildProvider.cs
- InvalidDataException.cs
- BindingRestrictions.cs
- UnionExpr.cs
- NodeInfo.cs
- RegistryPermission.cs
- BaseValidator.cs
- HttpRuntime.cs
- ConcurrentBag.cs
- CorruptStoreException.cs
- SecurityPolicySection.cs
- ExplicitDiscriminatorMap.cs
- FormatConvertedBitmap.cs
- CompilationLock.cs
- ToolStripButton.cs
- OdbcConnectionOpen.cs
- RequestCachingSection.cs
- InkCanvasAutomationPeer.cs
- xsdvalidator.cs
- SpecularMaterial.cs
- MetadataUtil.cs
- SqlStream.cs
- ActivityUtilities.cs
- SiteMapDataSource.cs
- SqlWorkflowInstanceStoreLock.cs
- SplineQuaternionKeyFrame.cs
- DataGridViewMethods.cs
- UniformGrid.cs
- DbModificationClause.cs
- ClientTarget.cs
- DesignTableCollection.cs
- ClientTargetCollection.cs
- GregorianCalendar.cs