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
- FormViewPagerRow.cs
- MouseWheelEventArgs.cs
- Win32PrintDialog.cs
- DbConnectionPoolGroup.cs
- XmlCountingReader.cs
- TypedColumnHandler.cs
- DateTimeFormatInfo.cs
- TabControl.cs
- UndoUnit.cs
- _HTTPDateParse.cs
- LoginName.cs
- ListBox.cs
- HostProtectionException.cs
- ObjectQueryExecutionPlan.cs
- TemplateNameScope.cs
- WebPartEditorApplyVerb.cs
- PrintDialogException.cs
- LocalizationParserHooks.cs
- DataServiceRequestException.cs
- CacheHelper.cs
- ContentOnlyMessage.cs
- TypeSystemProvider.cs
- OdbcEnvironmentHandle.cs
- CurrentTimeZone.cs
- MouseEventArgs.cs
- InputLangChangeRequestEvent.cs
- SqlWebEventProvider.cs
- SimpleBitVector32.cs
- AnimationException.cs
- RepeatBehaviorConverter.cs
- ToolStripComboBox.cs
- HttpChannelBindingToken.cs
- RequestCache.cs
- TraceXPathNavigator.cs
- Registry.cs
- CustomErrorsSectionWrapper.cs
- IisTraceListener.cs
- ObjectParameter.cs
- CustomValidator.cs
- _HeaderInfo.cs
- DockAndAnchorLayout.cs
- InternalBufferManager.cs
- ServiceNotStartedException.cs
- HostVisual.cs
- ItemMap.cs
- Msec.cs
- EnumDataContract.cs
- RecognizeCompletedEventArgs.cs
- DataStorage.cs
- UserNameSecurityTokenAuthenticator.cs
- ReferenceConverter.cs
- InvalidChannelBindingException.cs
- NetNamedPipeSecurity.cs
- BamlTreeMap.cs
- XPathLexer.cs
- XmlIlTypeHelper.cs
- StructuredTypeEmitter.cs
- ManagementInstaller.cs
- GroupBoxDesigner.cs
- BackgroundWorker.cs
- ButtonField.cs
- MethodBuilder.cs
- TreeNodeConverter.cs
- TokenizerHelper.cs
- OdbcDataReader.cs
- ObjectPropertyMapping.cs
- SqlInternalConnectionSmi.cs
- TextRunCache.cs
- CodeTypeDeclarationCollection.cs
- Point3DCollection.cs
- MsmqIntegrationOutputChannel.cs
- DefaultObjectSerializer.cs
- VectorKeyFrameCollection.cs
- ItemCheckedEvent.cs
- RelatedView.cs
- SaveFileDialog.cs
- MeshGeometry3D.cs
- RoutedEvent.cs
- ItemDragEvent.cs
- StylusPlugInCollection.cs
- MailBnfHelper.cs
- LicenseContext.cs
- TreeNode.cs
- DataGridViewRowsRemovedEventArgs.cs
- ProvidePropertyAttribute.cs
- TimeoutConverter.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- DependencyProperty.cs
- WindowsGrip.cs
- CodeGenerator.cs
- TypeContext.cs
- Registry.cs
- FixedDocument.cs
- RepeatButtonAutomationPeer.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- ListBindingHelper.cs
- RenderOptions.cs
- ConnectionPointCookie.cs
- HatchBrush.cs
- DbgUtil.cs