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
- BoundPropertyEntry.cs
- ReversePositionQuery.cs
- DesignerCommandSet.cs
- CompositionDesigner.cs
- InputReferenceExpression.cs
- StructuredProperty.cs
- ConnectionStringsExpressionEditor.cs
- Zone.cs
- VariableDesigner.xaml.cs
- OracleString.cs
- dataSvcMapFileLoader.cs
- _RegBlobWebProxyDataBuilder.cs
- HttpPostServerProtocol.cs
- SafeMILHandle.cs
- Attachment.cs
- CodeBinaryOperatorExpression.cs
- StyleModeStack.cs
- HierarchicalDataSourceControl.cs
- ImportedNamespaceContextItem.cs
- Message.cs
- ArgIterator.cs
- _SSPISessionCache.cs
- InvalidCastException.cs
- CLSCompliantAttribute.cs
- KeyTime.cs
- WebScriptServiceHost.cs
- ItemsControlAutomationPeer.cs
- ViewLoader.cs
- DateTimePicker.cs
- GlyphInfoList.cs
- RightsManagementEncryptedStream.cs
- ItemList.cs
- ApplicationFileParser.cs
- IISUnsafeMethods.cs
- ProfilePropertySettingsCollection.cs
- RichTextBoxConstants.cs
- RepeaterItemEventArgs.cs
- DataGridViewTextBoxColumn.cs
- FormView.cs
- HelpKeywordAttribute.cs
- JoinGraph.cs
- PagesChangedEventArgs.cs
- SqlParameter.cs
- StsCommunicationException.cs
- IteratorDescriptor.cs
- GridToolTip.cs
- XslTransform.cs
- BrowserTree.cs
- AutomationTextAttribute.cs
- BaseServiceProvider.cs
- EdmFunction.cs
- ContentWrapperAttribute.cs
- DataServiceQueryProvider.cs
- DataGridState.cs
- RayHitTestParameters.cs
- DataObjectFieldAttribute.cs
- SolidBrush.cs
- errorpatternmatcher.cs
- HostingEnvironment.cs
- Nodes.cs
- EdmTypeAttribute.cs
- HostVisual.cs
- WebPartEventArgs.cs
- ZoneLinkButton.cs
- codemethodreferenceexpression.cs
- IERequestCache.cs
- PEFileReader.cs
- XhtmlBasicControlAdapter.cs
- DES.cs
- DetailsViewUpdatedEventArgs.cs
- InvalidProgramException.cs
- DesignerVerbCollection.cs
- TdsParserSessionPool.cs
- LingerOption.cs
- PersonalizationStateQuery.cs
- TopClause.cs
- SectionInput.cs
- PersonalizablePropertyEntry.cs
- MoveSizeWinEventHandler.cs
- HttpConfigurationSystem.cs
- X509ScopedServiceCertificateElement.cs
- Serializer.cs
- InvokeSchedule.cs
- RuntimeTrackingProfile.cs
- OracleInfoMessageEventArgs.cs
- GatewayDefinition.cs
- ObjectTypeMapping.cs
- WsdlWriter.cs
- ScrollViewerAutomationPeer.cs
- IMembershipProvider.cs
- MachineKeySection.cs
- PageParserFilter.cs
- DeviceSpecificChoice.cs
- SessionStateModule.cs
- PropertyToken.cs
- ToolBarOverflowPanel.cs
- XmlEntity.cs
- GridView.cs
- ComponentEditorForm.cs
- CacheMode.cs