Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / ExtensionElementCollection.cs / 1 / ExtensionElementCollection.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System;
using System.Configuration;
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMap)]
public class ExtensionElementCollection : ServiceModelConfigurationElementCollection
{
public ExtensionElementCollection()
: base(ConfigurationElementCollectionType.BasicMap, ConfigurationStrings.Add)
{
}
protected override void BaseAdd(ConfigurationElement element)
{
this.EnforceUniqueElement((ExtensionElement)element);
base.BaseAdd(element);
}
protected override void BaseAdd(int index, ConfigurationElement element)
{
this.EnforceUniqueElement((ExtensionElement)element);
base.BaseAdd(index, element);
}
protected override object GetElementKey(ConfigurationElement element)
{
if (null == element)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
ExtensionElement configElementKey = (ExtensionElement) element;
return configElementKey.Name;
}
void EnforceUniqueElement(ExtensionElement element)
{
Type elementType = Type.GetType(element.Type, false);
foreach (ExtensionElement extension in this)
{
if (element.Name.Equals(extension.Name, StringComparison.Ordinal))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
SR.GetString(SR.ConfigDuplicateExtensionName, element.Name)));
}
if (null != elementType)
{
if (elementType.Equals(Type.GetType(extension.Type, false)))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
SR.GetString(SR.ConfigDuplicateExtensionType, element.Type)));
}
}
else
{
if (element.Type.Equals(extension.Type, StringComparison.OrdinalIgnoreCase))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
SR.GetString(SR.ConfigDuplicateExtensionType, element.Type)));
}
}
}
}
protected override bool ThrowOnDuplicate
{
get
{
return true;
}
}
}
}
// 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
- VarRefManager.cs
- GifBitmapDecoder.cs
- ToolBarButtonClickEvent.cs
- OleStrCAMarshaler.cs
- Baml2006ReaderFrame.cs
- WeakEventTable.cs
- XmlEventCache.cs
- ShapingEngine.cs
- StandardCommands.cs
- XslNumber.cs
- MetaModel.cs
- ProcessingInstructionAction.cs
- XPathNodePointer.cs
- ButtonBaseAdapter.cs
- EUCJPEncoding.cs
- LostFocusEventManager.cs
- TransformCollection.cs
- Canvas.cs
- ListControl.cs
- SqlProfileProvider.cs
- SecurityState.cs
- IsolatedStorageFileStream.cs
- MimeMultiPart.cs
- Light.cs
- TdsValueSetter.cs
- SHA1CryptoServiceProvider.cs
- StyleXamlParser.cs
- Subtree.cs
- ColumnClickEvent.cs
- CodeBlockBuilder.cs
- ServiceParser.cs
- Graphics.cs
- RootAction.cs
- HelpHtmlBuilder.cs
- xdrvalidator.cs
- TextContainerChangedEventArgs.cs
- X509CertificateTrustedIssuerElementCollection.cs
- ListView.cs
- SoundPlayerAction.cs
- PropertyAccessVisitor.cs
- OracleParameterCollection.cs
- LinearGradientBrush.cs
- Stack.cs
- SqlStatistics.cs
- IPEndPointCollection.cs
- AssociatedControlConverter.cs
- ReflectPropertyDescriptor.cs
- CheckBoxList.cs
- MatrixAnimationBase.cs
- Cursor.cs
- PingOptions.cs
- Exceptions.cs
- Tokenizer.cs
- DocumentOutline.cs
- StateMachineHelpers.cs
- XamlToRtfParser.cs
- SafeNativeMethods.cs
- DependencyObjectProvider.cs
- TcpProcessProtocolHandler.cs
- RecognizerInfo.cs
- PeerNameRecord.cs
- VectorCollectionValueSerializer.cs
- PointHitTestResult.cs
- ItemsPanelTemplate.cs
- Stackframe.cs
- counter.cs
- IndividualDeviceConfig.cs
- CallbackWrapper.cs
- DataMemberFieldEditor.cs
- ZipIOLocalFileHeader.cs
- FontFamilyConverter.cs
- XmlAttribute.cs
- HyperLink.cs
- AssemblyNameEqualityComparer.cs
- Decorator.cs
- DoubleLink.cs
- WebHttpSecurityModeHelper.cs
- DataColumnMappingCollection.cs
- WebContext.cs
- ParseChildrenAsPropertiesAttribute.cs
- FormsAuthenticationEventArgs.cs
- __Error.cs
- Soap.cs
- glyphs.cs
- SessionStateItemCollection.cs
- TextEditorDragDrop.cs
- DefaultAuthorizationContext.cs
- XmlDataDocument.cs
- EditCommandColumn.cs
- HttpModuleActionCollection.cs
- RuntimeArgumentHandle.cs
- TextEditorMouse.cs
- EntityClassGenerator.cs
- ToolBarOverflowPanel.cs
- SqlInfoMessageEvent.cs
- EventArgs.cs
- RegisteredScript.cs
- ContextQuery.cs
- SqlUDTStorage.cs
- ConnectivityStatus.cs