public void Configure(ConfigSource config) { consumerRequests = config.GetBoolean("consumerRequests"); ConfigSource child = config.GetChild("accessVerifier"); if (child != null) { string typeString = child.GetString("type"); if (String.IsNullOrEmpty(typeString)) { throw new ConfigurationException("The 'accessVerifier' type was not specified.", child, "type"); } Type type = Type.GetType(typeString, false, true); if (type == null) { throw new ConfigurationException("The type '" + typeString + "' could not be found.", child, "type"); } if (!typeof(IPathAccessVerifier).IsAssignableFrom(type)) { throw new ConfigurationException( "The type '" + type + "' cannot be is not an implementation of '" + typeof(IPathAccessVerifier) + "'.", child, "type"); } try { accessVerifier = (IPathAccessVerifier)Activator.CreateInstance(type); accessVerifier.Context = OAuthProvider.Current; accessVerifier.Configure(child); } catch (ConfigurationException) { throw; } catch (Exception e) { throw new ConfigurationException("Error while initializing the type '" + type + "': " + e.Message, e); } } }
public void Configure(ConfigSource config) { consumerRequests = config.GetBoolean("consumerRequests"); ConfigSource child = config.GetChild("accessVerifier"); if (child != null) { string typeString = child.GetString("type"); if (String.IsNullOrEmpty(typeString)) throw new ConfigurationException("The 'accessVerifier' type was not specified.", child, "type"); Type type = Type.GetType(typeString, false, true); if (type == null) throw new ConfigurationException("The type '" + typeString + "' could not be found.", child, "type"); if (!typeof (IPathAccessVerifier).IsAssignableFrom(type)) throw new ConfigurationException( "The type '" + type + "' cannot be is not an implementation of '" + typeof (IPathAccessVerifier) + "'.", child, "type"); try { accessVerifier = (IPathAccessVerifier) Activator.CreateInstance(type); accessVerifier.Context = OAuthProvider.Current; accessVerifier.Configure(child); } catch (ConfigurationException) { throw; } catch (Exception e) { throw new ConfigurationException("Error while initializing the type '" + type + "': " + e.Message, e); } } }