fix BaseRest config management - would throw when missing config files

This commit is contained in:
Stephan
2012-11-01 16:46:04 -01:00
parent 3ba31cc82c
commit 2c38f7ce7f
3 changed files with 11 additions and 2 deletions

View File

@@ -88,6 +88,9 @@ namespace Umbraco.Web.BaseRest
var config = (Configuration.BaseRestSection)System.Configuration.ConfigurationManager.GetSection("BaseRestExtensions");
if (config == null)
return null; // does not exist
// fixme - at the moment we reload the config file each time
// we have to support live edits of the config file for backward compatibility reason
// so if we want to cache, we'd also need to implement a watcher on the config file...
@@ -111,6 +114,9 @@ namespace Umbraco.Web.BaseRest
string typeName = eNode.Attributes["type"].Value;
Type type = assembly.GetType(typeName);
if (type == null)
return null; // does not exist
var method = type.GetMethod(methodName);
if (method == null)
@@ -135,6 +141,9 @@ namespace Umbraco.Web.BaseRest
{
var config = (Configuration.BaseRestSection)System.Configuration.ConfigurationManager.GetSection("BaseRestExtensions");
if (config == null)
return null; // does not exist
Configuration.ExtensionElement configExtension = config.Items[extensionAlias];
if (configExtension == null)
return null; // does not exist