Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Configuration / TagMapInfo.cs / 1 / TagMapInfo.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Web.Util; using System.Web.UI; using System.Web.Compilation; using System.Threading; using System.Web.Configuration; using System.Security.Permissions; [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class TagMapInfo : ConfigurationElement { private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propTagTypeName = new ConfigurationProperty("tagType", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); private static readonly ConfigurationProperty _propMappedTagTypeName = new ConfigurationProperty("mappedTagType", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired); static TagMapInfo() { _properties = new ConfigurationPropertyCollection(); _properties.Add(_propTagTypeName); _properties.Add(_propMappedTagTypeName); } internal TagMapInfo() { } public TagMapInfo(String tagTypeName, String mappedTagTypeName) : this() { TagType = tagTypeName; MappedTagType = mappedTagTypeName; } public override bool Equals(object o) { TagMapInfo tm = o as TagMapInfo; return StringUtil.Equals(TagType, tm.TagType) && StringUtil.Equals(MappedTagType, tm.MappedTagType); } public override int GetHashCode() { return TagType.GetHashCode() ^ MappedTagType.GetHashCode(); } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("mappedTagType")] [StringValidator(MinLength = 1)] public string MappedTagType { get { return (string)base[_propMappedTagTypeName]; } set { base[_propMappedTagTypeName] = value; } } [ConfigurationProperty("tagType", IsRequired = true, IsKey = true, DefaultValue = "")] [StringValidator(MinLength = 1)] public string TagType { get { return (string)base[_propTagTypeName]; } set { base[_propTagTypeName] = value; } } void Verify() { if (String.IsNullOrEmpty(TagType)) { throw new ConfigurationErrorsException( SR.GetString( SR.Config_base_required_attribute_missing, "tagType")); } if (String.IsNullOrEmpty(MappedTagType)) { throw new ConfigurationErrorsException( SR.GetString( SR.Config_base_required_attribute_missing, "mappedTagType")); } } protected override bool SerializeElement(XmlWriter writer, bool serializeCollectionKey) { Verify(); return base.SerializeElement(writer, serializeCollectionKey); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Web.Util; using System.Web.UI; using System.Web.Compilation; using System.Threading; using System.Web.Configuration; using System.Security.Permissions; [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class TagMapInfo : ConfigurationElement { private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propTagTypeName = new ConfigurationProperty("tagType", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); private static readonly ConfigurationProperty _propMappedTagTypeName = new ConfigurationProperty("mappedTagType", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired); static TagMapInfo() { _properties = new ConfigurationPropertyCollection(); _properties.Add(_propTagTypeName); _properties.Add(_propMappedTagTypeName); } internal TagMapInfo() { } public TagMapInfo(String tagTypeName, String mappedTagTypeName) : this() { TagType = tagTypeName; MappedTagType = mappedTagTypeName; } public override bool Equals(object o) { TagMapInfo tm = o as TagMapInfo; return StringUtil.Equals(TagType, tm.TagType) && StringUtil.Equals(MappedTagType, tm.MappedTagType); } public override int GetHashCode() { return TagType.GetHashCode() ^ MappedTagType.GetHashCode(); } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("mappedTagType")] [StringValidator(MinLength = 1)] public string MappedTagType { get { return (string)base[_propMappedTagTypeName]; } set { base[_propMappedTagTypeName] = value; } } [ConfigurationProperty("tagType", IsRequired = true, IsKey = true, DefaultValue = "")] [StringValidator(MinLength = 1)] public string TagType { get { return (string)base[_propTagTypeName]; } set { base[_propTagTypeName] = value; } } void Verify() { if (String.IsNullOrEmpty(TagType)) { throw new ConfigurationErrorsException( SR.GetString( SR.Config_base_required_attribute_missing, "tagType")); } if (String.IsNullOrEmpty(MappedTagType)) { throw new ConfigurationErrorsException( SR.GetString( SR.Config_base_required_attribute_missing, "mappedTagType")); } } protected override bool SerializeElement(XmlWriter writer, bool serializeCollectionKey) { Verify(); return base.SerializeElement(writer, serializeCollectionKey); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Control.cs
- ResourceDefaultValueAttribute.cs
- AuthorizationRule.cs
- SmtpCommands.cs
- CellLabel.cs
- ToolStripContainer.cs
- ValidationError.cs
- SmiEventSink_DeferedProcessing.cs
- ExtendedPropertyDescriptor.cs
- KeyMatchBuilder.cs
- WebHeaderCollection.cs
- LinearGradientBrush.cs
- MemberAssignment.cs
- TextTreeTextNode.cs
- ConstraintEnumerator.cs
- HuffmanTree.cs
- NameValueFileSectionHandler.cs
- BoundField.cs
- ConfigurationManagerHelperFactory.cs
- InlineObject.cs
- DeclarativeCatalogPart.cs
- PixelShader.cs
- WebPartPersonalization.cs
- IncomingWebResponseContext.cs
- OrderToken.cs
- dtdvalidator.cs
- ClosableStream.cs
- PropertyPushdownHelper.cs
- ChoiceConverter.cs
- DesignerVerb.cs
- DrawingAttributesDefaultValueFactory.cs
- Input.cs
- PictureBox.cs
- VisualStyleElement.cs
- XmlTypeAttribute.cs
- HtmlSelect.cs
- RegexGroup.cs
- Schema.cs
- DataTemplateSelector.cs
- ErrorFormatter.cs
- CodeTypeParameter.cs
- FontFamily.cs
- FontWeights.cs
- MetabaseReader.cs
- _OSSOCK.cs
- IEnumerable.cs
- UnicodeEncoding.cs
- ContainerParagraph.cs
- Random.cs
- AudienceUriMode.cs
- GridEntry.cs
- ArrangedElement.cs
- LostFocusEventManager.cs
- EventProviderBase.cs
- NamedPipeTransportBindingElement.cs
- ToolStripContainer.cs
- ClientViaElement.cs
- KeyFrames.cs
- DetailsViewCommandEventArgs.cs
- DoubleLinkListEnumerator.cs
- ChannelFactoryRefCache.cs
- CollectionViewSource.cs
- URI.cs
- FontTypeConverter.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- SqlColumnizer.cs
- TargetParameterCountException.cs
- TreeNodeStyle.cs
- ImageConverter.cs
- SystemBrushes.cs
- InkCanvasInnerCanvas.cs
- Rect3DValueSerializer.cs
- DataSourceDescriptorCollection.cs
- PeerContact.cs
- TransformGroup.cs
- ConfigXmlText.cs
- HandleDictionary.cs
- HttpCapabilitiesBase.cs
- Compiler.cs
- RightsManagementPermission.cs
- DataRecordInternal.cs
- TraceInternal.cs
- RegisteredDisposeScript.cs
- ContractListAdapter.cs
- XmlNamedNodeMap.cs
- AttributeTable.cs
- SQLDoubleStorage.cs
- DynamicPropertyReader.cs
- SettingsSection.cs
- X509ChainPolicy.cs
- CookielessHelper.cs
- CodeCompiler.cs
- ParagraphResult.cs
- MissingManifestResourceException.cs
- XmlWriter.cs
- OdbcConnectionOpen.cs
- DataBinder.cs
- PagerSettings.cs
- Encoder.cs
- ConfigXmlElement.cs