Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / TagMapCollection.cs / 3 / TagMapCollection.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; [ConfigurationCollection(typeof(TagMapInfo))] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class TagMapCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; private Hashtable _tagMappings; static TagMapCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } public TagMapCollection() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public TagMapInfo this[int index] { get { return (TagMapInfo)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } public void Add(TagMapInfo tagMapInformation) { BaseAdd(tagMapInformation); } public void Remove(TagMapInfo tagMapInformation) { BaseRemove(GetElementKey(tagMapInformation)); } public void Clear() { BaseClear(); } protected override ConfigurationElement CreateNewElement() { return new TagMapInfo(); } protected override Object GetElementKey(ConfigurationElement element) { return ((TagMapInfo)element).TagType; } internal Hashtable TagTypeMappingInternal { get { if (_tagMappings == null) { lock (this) { if (_tagMappings == null) { Hashtable tagMappings = new Hashtable(StringComparer.OrdinalIgnoreCase); foreach (TagMapInfo tmi in this) { Type tagType = ConfigUtil.GetType(tmi.TagType, "tagType", tmi); Type mappedTagType = ConfigUtil.GetType(tmi.MappedTagType, "mappedTagType", tmi); if (tagType.IsAssignableFrom(mappedTagType) == false) { throw new ConfigurationErrorsException( SR.GetString( SR.Mapped_type_must_inherit, tmi.MappedTagType, tmi.TagType), tmi.ElementInformation.Properties["mappedTagType"].Source, tmi.ElementInformation.Properties["mappedTagType"].LineNumber); } tagMappings[tagType] = mappedTagType; } _tagMappings = tagMappings; } } } return _tagMappings; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// 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; [ConfigurationCollection(typeof(TagMapInfo))] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class TagMapCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; private Hashtable _tagMappings; static TagMapCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } public TagMapCollection() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public TagMapInfo this[int index] { get { return (TagMapInfo)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } public void Add(TagMapInfo tagMapInformation) { BaseAdd(tagMapInformation); } public void Remove(TagMapInfo tagMapInformation) { BaseRemove(GetElementKey(tagMapInformation)); } public void Clear() { BaseClear(); } protected override ConfigurationElement CreateNewElement() { return new TagMapInfo(); } protected override Object GetElementKey(ConfigurationElement element) { return ((TagMapInfo)element).TagType; } internal Hashtable TagTypeMappingInternal { get { if (_tagMappings == null) { lock (this) { if (_tagMappings == null) { Hashtable tagMappings = new Hashtable(StringComparer.OrdinalIgnoreCase); foreach (TagMapInfo tmi in this) { Type tagType = ConfigUtil.GetType(tmi.TagType, "tagType", tmi); Type mappedTagType = ConfigUtil.GetType(tmi.MappedTagType, "mappedTagType", tmi); if (tagType.IsAssignableFrom(mappedTagType) == false) { throw new ConfigurationErrorsException( SR.GetString( SR.Mapped_type_must_inherit, tmi.MappedTagType, tmi.TagType), tmi.ElementInformation.Properties["mappedTagType"].Source, tmi.ElementInformation.Properties["mappedTagType"].LineNumber); } tagMappings[tagType] = mappedTagType; } _tagMappings = tagMappings; } } } return _tagMappings; } } } } // 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
- WizardForm.cs
- BasicCellRelation.cs
- TextBox.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- XamlSerializationHelper.cs
- SqlRowUpdatingEvent.cs
- ServiceInfo.cs
- ContentControl.cs
- MemberPath.cs
- PriorityBindingExpression.cs
- MultiBinding.cs
- AttributeProviderAttribute.cs
- ExpanderAutomationPeer.cs
- ResolveInfo.cs
- PeerEndPoint.cs
- HttpHandlerAction.cs
- PopupRootAutomationPeer.cs
- HttpVersion.cs
- StringExpressionSet.cs
- DateTimeFormat.cs
- InternalSafeNativeMethods.cs
- InputProviderSite.cs
- RegistryKey.cs
- WizardForm.cs
- CommandHelper.cs
- MenuAdapter.cs
- AttachmentCollection.cs
- AsymmetricKeyExchangeFormatter.cs
- TrustManagerPromptUI.cs
- InternalDuplexChannelListener.cs
- XmlSchemaSimpleTypeList.cs
- UserInitiatedNavigationPermission.cs
- WebService.cs
- DecoderReplacementFallback.cs
- IntegerCollectionEditor.cs
- SystemNetworkInterface.cs
- MD5.cs
- CachedPathData.cs
- CapabilitiesUse.cs
- InputLanguage.cs
- ComboBoxAutomationPeer.cs
- Models.cs
- DayRenderEvent.cs
- XsltInput.cs
- ToolStripItemTextRenderEventArgs.cs
- ConnectionStringSettingsCollection.cs
- Sql8ExpressionRewriter.cs
- CommonProperties.cs
- BitmapPalettes.cs
- Directory.cs
- XmlArrayItemAttributes.cs
- URIFormatException.cs
- Stack.cs
- DataColumnMappingCollection.cs
- LinearKeyFrames.cs
- Debugger.cs
- PnrpPermission.cs
- WorkflowOperationBehavior.cs
- EllipticalNodeOperations.cs
- QueryResponse.cs
- CookielessHelper.cs
- XmlSortKey.cs
- BindingListCollectionView.cs
- HiddenFieldPageStatePersister.cs
- ObjectList.cs
- GetFileNameResult.cs
- StorageEntitySetMapping.cs
- ToolStripPanel.cs
- XmlException.cs
- TextFormatterImp.cs
- Constraint.cs
- ImageSource.cs
- ExpandSegment.cs
- ObjectQuery_EntitySqlExtensions.cs
- KeyFrames.cs
- FrameworkObject.cs
- DataError.cs
- Int16Converter.cs
- AnnotationResourceCollection.cs
- CommandValueSerializer.cs
- ConfigurationPropertyAttribute.cs
- OlePropertyStructs.cs
- VBIdentifierTrimConverter.cs
- SslStream.cs
- NativeMethods.cs
- FormattedText.cs
- ErrorProvider.cs
- DependencyPropertyChangedEventArgs.cs
- WindowsStreamSecurityUpgradeProvider.cs
- EmissiveMaterial.cs
- TimelineClockCollection.cs
- Operand.cs
- GeneralTransform3DTo2D.cs
- StrokeNodeOperations.cs
- ITextView.cs
- PrintDialog.cs
- FolderNameEditor.cs
- dbenumerator.cs
- ProviderUtil.cs
- DataGridTableCollection.cs