Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / ProvidersHelper.cs / 3 / ProvidersHelper.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Configuration; using System.Configuration.Provider; using System.Web.Compilation; using System.Collections.Specialized; using System; using System.Security; using System.Security.Permissions; [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public static class ProvidersHelper { /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)] public static ProviderBase InstantiateProvider(ProviderSettings providerSettings, Type providerType) { ProviderBase provider = null; try { string pnType = (providerSettings.Type == null) ? null : providerSettings.Type.Trim(); if (string.IsNullOrEmpty(pnType)) throw new ArgumentException(SR.GetString(SR.Provider_no_type_name)); Type t = ConfigUtil.GetType(pnType, "type", providerSettings, true, true); if (!providerType.IsAssignableFrom(t)) throw new ArgumentException(SR.GetString(SR.Provider_must_implement_type, providerType.ToString())); provider = (ProviderBase)HttpRuntime.CreatePublicInstance(t); // Because providers modify the parameters collection (i.e. delete stuff), pass in a clone of the collection NameValueCollection pars = providerSettings.Parameters; NameValueCollection cloneParams = new NameValueCollection(pars.Count, StringComparer.Ordinal); foreach (string key in pars) cloneParams[key] = pars[key]; provider.Initialize(providerSettings.Name, cloneParams); } catch (Exception e) { if (e is ConfigurationException) throw; throw new ConfigurationErrorsException(e.Message, providerSettings.ElementInformation.Properties["type"].Source, providerSettings.ElementInformation.Properties["type"].LineNumber); } return provider; } [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)] public static void InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) { foreach (ProviderSettings ps in configProviders) { providers.Add(InstantiateProvider(ps, providerType)); } } } } // 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
- ServiceOperationInvoker.cs
- HtmlWindowCollection.cs
- FilterException.cs
- DataSourceControlBuilder.cs
- NavigationFailedEventArgs.cs
- XamlTemplateSerializer.cs
- XPathNodeIterator.cs
- PolicyAssertionCollection.cs
- Translator.cs
- VisualTreeFlattener.cs
- MissingMethodException.cs
- EventHandlersStore.cs
- DispatcherOperation.cs
- HttpAsyncResult.cs
- PropertyToken.cs
- FixedTextContainer.cs
- EdmProperty.cs
- DashStyle.cs
- DefaultShape.cs
- WebHttpBinding.cs
- SeekStoryboard.cs
- UnsafeNativeMethods.cs
- AudioFormatConverter.cs
- TrackingParameters.cs
- MediaContextNotificationWindow.cs
- EarlyBoundInfo.cs
- DisableDpiAwarenessAttribute.cs
- SqlDataSourceSummaryPanel.cs
- DocumentXmlWriter.cs
- Debug.cs
- ImageList.cs
- HttpRuntimeSection.cs
- Brush.cs
- Win32PrintDialog.cs
- TemplateComponentConnector.cs
- PreDigestedSignedInfo.cs
- DataObject.cs
- GraphicsPath.cs
- EventLogInformation.cs
- uribuilder.cs
- _ProxyChain.cs
- DynamicActionMessageFilter.cs
- DesignerTransaction.cs
- OrderedDictionary.cs
- SQLGuid.cs
- DES.cs
- XhtmlBasicImageAdapter.cs
- NullRuntimeConfig.cs
- GeneralTransformCollection.cs
- MediaElementAutomationPeer.cs
- Speller.cs
- CultureSpecificStringDictionary.cs
- TypeUsageBuilder.cs
- WebZoneDesigner.cs
- XmlSignificantWhitespace.cs
- EntityDataReader.cs
- ObjectDisposedException.cs
- HelloMessage11.cs
- OdbcEnvironment.cs
- WindowsImpersonationContext.cs
- OperatorExpressions.cs
- SetterTriggerConditionValueConverter.cs
- OleDbDataReader.cs
- AssemblyHash.cs
- SoapCommonClasses.cs
- CapabilitiesSection.cs
- TriState.cs
- BooleanExpr.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- FactoryGenerator.cs
- _LazyAsyncResult.cs
- Guid.cs
- Clause.cs
- ChineseLunisolarCalendar.cs
- EntityDataSourceContextDisposingEventArgs.cs
- Tokenizer.cs
- SapiRecognizer.cs
- ModifyActivitiesPropertyDescriptor.cs
- TypeGenericEnumerableViewSchema.cs
- TreeNodeSelectionProcessor.cs
- PermissionSetEnumerator.cs
- PathStreamGeometryContext.cs
- ProjectedSlot.cs
- PrintingPermission.cs
- CodeLabeledStatement.cs
- RecordManager.cs
- Effect.cs
- precedingsibling.cs
- Header.cs
- BitmapEffectInputData.cs
- TextTreeRootNode.cs
- Point3DCollectionValueSerializer.cs
- HostingEnvironmentException.cs
- SessionStateModule.cs
- DialogBaseForm.cs
- WeakReferenceKey.cs
- StreamInfo.cs
- ReflectionUtil.cs
- WrappedReader.cs
- XPathSelfQuery.cs