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
- SourceLineInfo.cs
- HyperLink.cs
- BuilderPropertyEntry.cs
- TreeSet.cs
- DLinqTableProvider.cs
- ActivityAction.cs
- ToolZone.cs
- MsmqNonTransactedPoisonHandler.cs
- FusionWrap.cs
- SafeTimerHandle.cs
- SurrogateEncoder.cs
- List.cs
- Opcode.cs
- Collection.cs
- ResourceAssociationSetEnd.cs
- StyleXamlParser.cs
- TimeSpanSecondsConverter.cs
- FixedSOMTableCell.cs
- UnsafeNativeMethodsCLR.cs
- PathGeometry.cs
- TextTreeUndoUnit.cs
- DataGridViewRowCollection.cs
- Overlapped.cs
- BrowserCapabilitiesCodeGenerator.cs
- ServiceHostingEnvironmentSection.cs
- SystemIdentity.cs
- PackWebRequest.cs
- WebPartConnectionsConfigureVerb.cs
- ProtocolsConfiguration.cs
- SqlNodeAnnotation.cs
- Configuration.cs
- PasswordPropertyTextAttribute.cs
- HotCommands.cs
- NameScopePropertyAttribute.cs
- StyleSheet.cs
- IItemProperties.cs
- HtmlElementEventArgs.cs
- UIPermission.cs
- SchemaType.cs
- DesigntimeLicenseContextSerializer.cs
- FrameworkElement.cs
- RegexGroup.cs
- LineServicesCallbacks.cs
- behaviorssection.cs
- ReflectionServiceProvider.cs
- ColorTransformHelper.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- CodeGotoStatement.cs
- KeyTimeConverter.cs
- UIPermission.cs
- SerializationStore.cs
- DataGridViewRow.cs
- ResourcesBuildProvider.cs
- SystemIPInterfaceProperties.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- XpsS0ValidatingLoader.cs
- InputLanguageManager.cs
- StackSpiller.Generated.cs
- ScrollItemPattern.cs
- AstTree.cs
- InstanceKeyCollisionException.cs
- TextTabProperties.cs
- RewritingPass.cs
- Triplet.cs
- XpsS0ValidatingLoader.cs
- JapaneseLunisolarCalendar.cs
- OracleLob.cs
- StreamResourceInfo.cs
- HideDisabledControlAdapter.cs
- TransactionTraceIdentifier.cs
- dbdatarecord.cs
- NotifyCollectionChangedEventArgs.cs
- ItemsControl.cs
- BindingSource.cs
- BitmapEffectState.cs
- IndependentAnimationStorage.cs
- SQLSingle.cs
- GeometryCombineModeValidation.cs
- DictionaryGlobals.cs
- RegexCode.cs
- PasswordRecoveryDesigner.cs
- PropertyItem.cs
- IndexedEnumerable.cs
- XmlBinaryReader.cs
- PerformanceCounterLib.cs
- LocalFileSettingsProvider.cs
- ScriptIgnoreAttribute.cs
- WindowsStartMenu.cs
- DynamicValueConverter.cs
- GridItemPatternIdentifiers.cs
- CustomError.cs
- RightsManagementEncryptionTransform.cs
- StrongNameUtility.cs
- ValidationPropertyAttribute.cs
- MaterialCollection.cs
- NativeRecognizer.cs
- CustomError.cs
- SqlDataSourceConfigureSelectPanel.cs
- WebDescriptionAttribute.cs
- ManagedCodeMarkers.cs