Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / FolderLevelBuildProviderCollection.cs / 1305376 / FolderLevelBuildProviderCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Collections.Generic; using System.Configuration; using System.Web.Compilation; // class CompilationSection [ConfigurationCollection(typeof(FolderLevelBuildProvider))] public sealed class FolderLevelBuildProviderCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; private Dictionary> _buildProviderMappings; private HashSet _buildProviderTypes; private bool _folderLevelBuildProviderTypesSet; static FolderLevelBuildProviderCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } public FolderLevelBuildProviderCollection() : base(StringComparer.OrdinalIgnoreCase) { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public new BuildProvider this[string name] { get { return (BuildProvider)BaseGet(name); } } public FolderLevelBuildProvider this[int index] { get { return (FolderLevelBuildProvider)BaseGet(index); } set { if (BaseGet(index) != null) BaseRemoveAt(index); BaseAdd(index, value); } } public void Add(FolderLevelBuildProvider buildProvider) { BaseAdd(buildProvider); } public void Remove(String name) { BaseRemove(name); } public void RemoveAt(int index) { BaseRemoveAt(index); } public void Clear() { BaseClear(); } protected override ConfigurationElement CreateNewElement() { return new FolderLevelBuildProvider(); } protected override Object GetElementKey(ConfigurationElement element) { return ((FolderLevelBuildProvider)element).Name; } // Add a mapping from appliesTo to the buildProviderType private void AddMapping(FolderLevelBuildProviderAppliesTo appliesTo, Type buildProviderType) { if (_buildProviderMappings == null) { _buildProviderMappings = new Dictionary >(); } if (_buildProviderTypes == null) { _buildProviderTypes = new HashSet (); } List buildProviders = null; if (!_buildProviderMappings.TryGetValue(appliesTo, out buildProviders)) { buildProviders = new List (); _buildProviderMappings.Add(appliesTo, buildProviders); } buildProviders.Add(buildProviderType); _buildProviderTypes.Add(buildProviderType); } internal List GetBuildProviderTypes(FolderLevelBuildProviderAppliesTo appliesTo) { EnsureFolderLevelBuildProvidersInitialized(); var buildProviders = new List (); if (_buildProviderMappings != null) { foreach (var pair in _buildProviderMappings) { if ((pair.Key & appliesTo) != 0) { buildProviders.AddRange(pair.Value); } } } return buildProviders; } internal bool IsFolderLevelBuildProvider(Type t) { EnsureFolderLevelBuildProvidersInitialized(); if (_buildProviderTypes != null) { return _buildProviderTypes.Contains(t); } return false; } // Initialize the dictionary mapping appliesTo to buildProvider types private void EnsureFolderLevelBuildProvidersInitialized() { if (!_folderLevelBuildProviderTypesSet) { lock (this) { if (!_folderLevelBuildProviderTypesSet) { foreach (FolderLevelBuildProvider buildProvider in this) { AddMapping(buildProvider.AppliesToInternal, buildProvider.TypeInternal); } _folderLevelBuildProviderTypesSet = true; } } } } } } // 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.Collections.Generic; using System.Configuration; using System.Web.Compilation; // class CompilationSection [ConfigurationCollection(typeof(FolderLevelBuildProvider))] public sealed class FolderLevelBuildProviderCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; private Dictionary> _buildProviderMappings; private HashSet _buildProviderTypes; private bool _folderLevelBuildProviderTypesSet; static FolderLevelBuildProviderCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } public FolderLevelBuildProviderCollection() : base(StringComparer.OrdinalIgnoreCase) { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public new BuildProvider this[string name] { get { return (BuildProvider)BaseGet(name); } } public FolderLevelBuildProvider this[int index] { get { return (FolderLevelBuildProvider)BaseGet(index); } set { if (BaseGet(index) != null) BaseRemoveAt(index); BaseAdd(index, value); } } public void Add(FolderLevelBuildProvider buildProvider) { BaseAdd(buildProvider); } public void Remove(String name) { BaseRemove(name); } public void RemoveAt(int index) { BaseRemoveAt(index); } public void Clear() { BaseClear(); } protected override ConfigurationElement CreateNewElement() { return new FolderLevelBuildProvider(); } protected override Object GetElementKey(ConfigurationElement element) { return ((FolderLevelBuildProvider)element).Name; } // Add a mapping from appliesTo to the buildProviderType private void AddMapping(FolderLevelBuildProviderAppliesTo appliesTo, Type buildProviderType) { if (_buildProviderMappings == null) { _buildProviderMappings = new Dictionary >(); } if (_buildProviderTypes == null) { _buildProviderTypes = new HashSet (); } List buildProviders = null; if (!_buildProviderMappings.TryGetValue(appliesTo, out buildProviders)) { buildProviders = new List (); _buildProviderMappings.Add(appliesTo, buildProviders); } buildProviders.Add(buildProviderType); _buildProviderTypes.Add(buildProviderType); } internal List GetBuildProviderTypes(FolderLevelBuildProviderAppliesTo appliesTo) { EnsureFolderLevelBuildProvidersInitialized(); var buildProviders = new List (); if (_buildProviderMappings != null) { foreach (var pair in _buildProviderMappings) { if ((pair.Key & appliesTo) != 0) { buildProviders.AddRange(pair.Value); } } } return buildProviders; } internal bool IsFolderLevelBuildProvider(Type t) { EnsureFolderLevelBuildProvidersInitialized(); if (_buildProviderTypes != null) { return _buildProviderTypes.Contains(t); } return false; } // Initialize the dictionary mapping appliesTo to buildProvider types private void EnsureFolderLevelBuildProvidersInitialized() { if (!_folderLevelBuildProviderTypesSet) { lock (this) { if (!_folderLevelBuildProviderTypesSet) { foreach (FolderLevelBuildProvider buildProvider in this) { AddMapping(buildProvider.AppliesToInternal, buildProvider.TypeInternal); } _folderLevelBuildProviderTypesSet = true; } } } } } } // 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
- MultiAsyncResult.cs
- Expr.cs
- listitem.cs
- SQLMoneyStorage.cs
- HttpRequest.cs
- CounterNameConverter.cs
- FtpRequestCacheValidator.cs
- GridViewRowPresenter.cs
- ChtmlSelectionListAdapter.cs
- XomlCompilerHelpers.cs
- NetNamedPipeSecurityElement.cs
- MessageQueueAccessControlEntry.cs
- HttpVersion.cs
- FileDataSourceCache.cs
- Container.cs
- PermissionRequestEvidence.cs
- SimpleLine.cs
- XPathNodePointer.cs
- TextTreeRootNode.cs
- PluralizationService.cs
- ISAPIApplicationHost.cs
- SspiSafeHandles.cs
- PropertyGeneratedEventArgs.cs
- PolicyException.cs
- SqlReorderer.cs
- RemotingException.cs
- Application.cs
- CellLabel.cs
- WhiteSpaceTrimStringConverter.cs
- Message.cs
- TrackingStringDictionary.cs
- DragCompletedEventArgs.cs
- FileController.cs
- SQLSingleStorage.cs
- ButtonField.cs
- CallbackWrapper.cs
- EntityRecordInfo.cs
- AuthenticationException.cs
- HtmlTableRowCollection.cs
- DataGridViewRowPostPaintEventArgs.cs
- Menu.cs
- ExecutionProperties.cs
- MatchingStyle.cs
- ToolStripSystemRenderer.cs
- initElementDictionary.cs
- Stack.cs
- XmlNodeReader.cs
- PaintValueEventArgs.cs
- InfoCardXmlSerializer.cs
- RegexInterpreter.cs
- StorageAssociationSetMapping.cs
- AtlasWeb.Designer.cs
- ArgumentsParser.cs
- NCryptSafeHandles.cs
- safelink.cs
- DesignerUtility.cs
- DataObjectAttribute.cs
- NamedServiceModelExtensionCollectionElement.cs
- XmlChoiceIdentifierAttribute.cs
- GridViewSortEventArgs.cs
- ExpressionConverter.cs
- DataRelation.cs
- Schema.cs
- ExpressionsCollectionConverter.cs
- RowBinding.cs
- RectValueSerializer.cs
- RenamedEventArgs.cs
- RemoteAsymmetricSignatureFormatter.cs
- PersonalizationStateQuery.cs
- StringReader.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- EntitySetRetriever.cs
- AlphaSortedEnumConverter.cs
- DbConnectionOptions.cs
- ValueTypeFixupInfo.cs
- PathGeometry.cs
- TextSimpleMarkerProperties.cs
- ListViewHitTestInfo.cs
- ProfessionalColorTable.cs
- SessionState.cs
- ReaderWriterLockWrapper.cs
- FlowLayout.cs
- AlphabetConverter.cs
- EntityDataSourceDataSelection.cs
- LoginViewDesigner.cs
- PagedDataSource.cs
- BuildResult.cs
- RemotingConfiguration.cs
- TreeBuilderBamlTranslator.cs
- SliderAutomationPeer.cs
- XmlTextReaderImplHelpers.cs
- DateTimeSerializationSection.cs
- ProcessModelSection.cs
- ValueCollectionParameterReader.cs
- FindCompletedEventArgs.cs
- BoundingRectTracker.cs
- RegexMatch.cs
- TerminateDesigner.cs
- ContractCodeDomInfo.cs
- ExpressionConverter.cs