/// <summary> /// Creates a new provider used to strip source control bindings. /// </summary> /// <param name="context">An <see cref="ApplicationContext"/> object containing contextual information.</param> /// <returns>A new <see cref="StripSccBindingsProvider"/> object.</returns> public static StripSccBindingsProviderBase CreateProvider(ApplicationContext context) { StripSccBindingsProviderBase provider = null; StripSccBindingsSection section = (StripSccBindingsSection)ConfigurationManager.GetSection(StripSccBindingsSection.SectionName); if (section == null) { throw new Exception("Could not find the provider section configuration in the application configuration file."); } else { ProviderSettings settings = section.Providers[context.Provider]; if (settings == null) { throw new Exception(string.Format("Could not find the provider '{0}' specified in the application configuration file.", context.Provider)); } AssemblyQualifiedTypeNameConverter converter = new AssemblyQualifiedTypeNameConverter(); Type type = (Type)converter.ConvertFrom(settings.Type); if (type != null) { provider = (StripSccBindingsProviderBase)Activator.CreateInstance(type); provider.Context = context; // Initialize the provider based on the configuration file. provider.Initialize(settings.Name, settings.Parameters); } } return(provider); }
/// <summary> /// Initializes a new instance of the <see cref="LoggingExceptionHandler"/> class. /// </summary> /// <param name="configValues"> /// The config values. /// </param> public LoggingExceptionHandler(NameValueCollection configValues) { this.formatterType = (Type)TypeConverter.ConvertFrom(configValues["formatterType"]); }