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
- _IPv6Address.cs
- UserControlParser.cs
- AppSecurityManager.cs
- FieldToken.cs
- SqlProcedureAttribute.cs
- DecimalKeyFrameCollection.cs
- cookiecollection.cs
- MetadataSource.cs
- ExpressionEditorAttribute.cs
- EmissiveMaterial.cs
- ComponentSerializationService.cs
- EditCommandColumn.cs
- StateRuntime.cs
- ThreadStartException.cs
- Themes.cs
- GridViewColumnHeaderAutomationPeer.cs
- AuthenticatedStream.cs
- BrowserCapabilitiesFactory35.cs
- HuffModule.cs
- TabControlToolboxItem.cs
- WrappedIUnknown.cs
- ValueSerializer.cs
- ButtonAutomationPeer.cs
- GeometryModel3D.cs
- ProfilePropertyMetadata.cs
- fixedPageContentExtractor.cs
- ComEventsInfo.cs
- DeploymentSectionCache.cs
- NotificationContext.cs
- VariantWrapper.cs
- WorkflowPrinting.cs
- ForeignConstraint.cs
- BuildResult.cs
- XmlConvert.cs
- MimeBasePart.cs
- DataSourceControl.cs
- Scene3D.cs
- ContentDisposition.cs
- MatrixKeyFrameCollection.cs
- BypassElementCollection.cs
- X509IssuerSerialKeyIdentifierClause.cs
- GridView.cs
- TypeSystemProvider.cs
- CachedTypeface.cs
- MLangCodePageEncoding.cs
- MouseEvent.cs
- XmlHierarchicalEnumerable.cs
- OraclePermissionAttribute.cs
- ExtentKey.cs
- OdbcConnectionOpen.cs
- DefaultPerformanceCounters.cs
- XmlSchemaCollection.cs
- Substitution.cs
- LocationUpdates.cs
- CompilerCollection.cs
- TimerElapsedEvenArgs.cs
- ListSourceHelper.cs
- WindowsClaimSet.cs
- ValidationPropertyAttribute.cs
- FrameworkElementFactoryMarkupObject.cs
- ActivityBindForm.Designer.cs
- KeyTime.cs
- PeerNameResolver.cs
- TextLine.cs
- ToolStripProgressBar.cs
- TableLayout.cs
- ClientSettingsStore.cs
- ETagAttribute.cs
- AttachInfo.cs
- OrderPreservingPipeliningMergeHelper.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- CqlErrorHelper.cs
- ProgressBar.cs
- TrackingWorkflowEventArgs.cs
- RenderingBiasValidation.cs
- DynamicDocumentPaginator.cs
- CoTaskMemHandle.cs
- WebRequestModulesSection.cs
- TextClipboardData.cs
- AutomationPeer.cs
- DesignTimeVisibleAttribute.cs
- DataObjectPastingEventArgs.cs
- _ConnectOverlappedAsyncResult.cs
- TransformerTypeCollection.cs
- ParseHttpDate.cs
- ServicePointManager.cs
- Vars.cs
- ProviderCommandInfoUtils.cs
- TreeNodeStyleCollection.cs
- prefixendpointaddressmessagefiltertable.cs
- HtmlTableCellCollection.cs
- PathGeometry.cs
- Funcletizer.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- SynchronizedDispatch.cs
- QilReplaceVisitor.cs
- ObjectItemCachedAssemblyLoader.cs
- SqlConnectionPoolGroupProviderInfo.cs
- SessionSwitchEventArgs.cs
- Visitors.cs