Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / XPathMessageFilterElementCollection.cs / 1 / XPathMessageFilterElementCollection.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System; using System.ServiceModel.Dispatcher; using System.Configuration; using System.Globalization; using System.ServiceModel; [ConfigurationCollection(typeof(XPathMessageFilterElement))] public sealed class XPathMessageFilterElementCollection : ServiceModelConfigurationElementCollection{ public XPathMessageFilterElementCollection() : base(ConfigurationElementCollectionType.AddRemoveClearMap, null, new XPathMessageFilterElementComparer()) { } public override bool ContainsKey(object key) { if (key == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("key"); } string newKey = string.Empty; if (key.GetType().IsAssignableFrom(typeof(XPathMessageFilter))) { newKey = XPathMessageFilterElementComparer.ParseXPathString((XPathMessageFilter)key); } else if (key.GetType().IsAssignableFrom(typeof(string))) { newKey = (string)key; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.ConfigInvalidKeyType, "XPathMessageFilterElement", typeof(XPathMessageFilter).AssemblyQualifiedName, key.GetType().AssemblyQualifiedName))); } return base.ContainsKey(newKey); } protected override Object GetElementKey(ConfigurationElement element) { if (element == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } XPathMessageFilterElement configElement = (XPathMessageFilterElement)element; if (configElement.Filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("element", SR.GetString(SR.ConfigXPathFilterIsNull)); } return XPathMessageFilterElementComparer.ParseXPathString(configElement.Filter); } protected override ConfigurationPropertyCollection Properties { get { return new ConfigurationPropertyCollection(); } } public override XPathMessageFilterElement this[object key] { get { if (key == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("key"); } if (!key.GetType().IsAssignableFrom(typeof(XPathMessageFilter))) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.ConfigInvalidKeyType, "XPathMessageFilterElement", typeof(XPathMessageFilter).AssemblyQualifiedName, key.GetType().AssemblyQualifiedName))); } XPathMessageFilterElement retval = (XPathMessageFilterElement)this.BaseGet(key); if (retval == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new System.Collections.Generic.KeyNotFoundException( SR.GetString(SR.ConfigKeyNotFoundInElementCollection, key.ToString()))); } return retval; } set { if (this.IsReadOnly()) { Add(value); } if (value == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } if (key == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("key"); } if (!key.GetType().IsAssignableFrom(typeof(XPathMessageFilter))) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.ConfigInvalidKeyType, "XPathMessageFilterElement", typeof(XPathMessageFilter).AssemblyQualifiedName, key.GetType().AssemblyQualifiedName))); } string oldKey = XPathMessageFilterElementComparer.ParseXPathString((XPathMessageFilter)key); string newKey = (string)this.GetElementKey(value); if (String.Equals(oldKey, newKey, StringComparison.Ordinal)) { if (BaseGet(key) != null) { BaseRemove(key); } Add(value); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ConfigKeysDoNotMatch, this.GetElementKey(value).ToString(), key.ToString())); } } } } } // 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
- PropertyMap.cs
- NameNode.cs
- WebConfigurationHostFileChange.cs
- DataGridViewHitTestInfo.cs
- ScalarType.cs
- SmiEventSink_DeferedProcessing.cs
- ResourcePermissionBase.cs
- XmlReflectionImporter.cs
- CultureNotFoundException.cs
- PreviewKeyDownEventArgs.cs
- UITypeEditor.cs
- BoundsDrawingContextWalker.cs
- HideDisabledControlAdapter.cs
- VisualStyleTypesAndProperties.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- EntityClassGenerator.cs
- CreateUserWizard.cs
- ListItemCollection.cs
- EncryptedKey.cs
- BindUriHelper.cs
- BuildDependencySet.cs
- WpfXamlLoader.cs
- Formatter.cs
- TextSchema.cs
- RectangleHotSpot.cs
- XmlSchemas.cs
- SerializationStore.cs
- basenumberconverter.cs
- ServiceNameElementCollection.cs
- SqlConnectionString.cs
- LocalFileSettingsProvider.cs
- PriorityChain.cs
- TemplateBindingExpression.cs
- X509ClientCertificateCredentialsElement.cs
- TransactedReceiveScope.cs
- FrameworkElementAutomationPeer.cs
- SystemIPInterfaceStatistics.cs
- RectangleHotSpot.cs
- AssemblySettingAttributes.cs
- DataGridItemCollection.cs
- HttpListenerPrefixCollection.cs
- Geometry3D.cs
- StringExpressionSet.cs
- Lease.cs
- CompositeTypefaceMetrics.cs
- EventlogProvider.cs
- XmlTextWriter.cs
- SimpleType.cs
- BindingList.cs
- PreProcessInputEventArgs.cs
- unsafenativemethodsother.cs
- Permission.cs
- UserPersonalizationStateInfo.cs
- NextPreviousPagerField.cs
- ComplexTypeEmitter.cs
- TriggerCollection.cs
- PeerMessageDispatcher.cs
- XmlSchemaAttribute.cs
- Document.cs
- CompositeFontInfo.cs
- securitycriticaldataClass.cs
- PopupRootAutomationPeer.cs
- FormsAuthenticationTicket.cs
- CompoundFileStreamReference.cs
- SemanticValue.cs
- AutoResetEvent.cs
- UserControl.cs
- DataGridViewCellStyle.cs
- SqlProvider.cs
- SchemaExporter.cs
- PropertyGroupDescription.cs
- _UriTypeConverter.cs
- RandomNumberGenerator.cs
- FileDocument.cs
- SchemaConstraints.cs
- InvalidPrinterException.cs
- unsafenativemethodstextservices.cs
- BrowserCapabilitiesCodeGenerator.cs
- FolderBrowserDialog.cs
- DNS.cs
- LinkClickEvent.cs
- pingexception.cs
- ScrollViewerAutomationPeer.cs
- NetCodeGroup.cs
- SecurityTokenContainer.cs
- Delegate.cs
- DateTimeConverter2.cs
- PageCodeDomTreeGenerator.cs
- XmlExtensionFunction.cs
- PointKeyFrameCollection.cs
- QuaternionAnimation.cs
- AdditionalEntityFunctions.cs
- ComponentResourceKey.cs
- XAMLParseException.cs
- FloaterBaseParagraph.cs
- DataGridViewComboBoxColumn.cs
- FixedSOMTextRun.cs
- XomlCompilerError.cs
- DecoderBestFitFallback.cs
- DbDataSourceEnumerator.cs