Renamed config interfaces properly with Section suffix, re-implemented the For<T> UmbracoConfiguration method to retreive specific settings... might use this entirely instead of the nested access as it might make it easier to mock.
This commit is contained in:
@@ -4,19 +4,12 @@ using System.Configuration;
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
[ConfigurationKey("BaseRestExtensions")]
|
||||
internal class BaseRestSection : UmbracoConfigurationSection, IBaseRest
|
||||
internal class BaseRestSection : UmbracoConfigurationSection, IBaseRestSection
|
||||
{
|
||||
private const string KeyEnabled = "enabled";
|
||||
|
||||
private bool? _enabled;
|
||||
|
||||
//internal protected override void ResetSection()
|
||||
//{
|
||||
// base.ResetSection();
|
||||
|
||||
// _enabled = null;
|
||||
//}
|
||||
|
||||
|
||||
[ConfigurationProperty("", IsKey = false, IsRequired = false, IsDefaultCollection = true)]
|
||||
public ExtensionElementCollection Items
|
||||
{
|
||||
@@ -36,7 +29,7 @@ namespace Umbraco.Core.Configuration.BaseRest
|
||||
internal set { _enabled = value; }
|
||||
}
|
||||
|
||||
IExtensionsCollection IBaseRest.Items
|
||||
IExtensionsCollection IBaseRestSection.Items
|
||||
{
|
||||
get { return Items; }
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
|
||||
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
|
||||
internal class ExtensionElement : ConfigurationElementCollection, IEnumerable<IMethod>, IExtension
|
||||
internal class ExtensionElement : ConfigurationElementCollection, IEnumerable<IMethodSection>, IExtension
|
||||
{
|
||||
const string KeyAlias = "alias";
|
||||
const string KeyType = "type";
|
||||
@@ -59,11 +59,11 @@ namespace Umbraco.Core.Configuration.BaseRest
|
||||
get { return (MethodElement)BaseGet(index); }
|
||||
}
|
||||
|
||||
IEnumerator<IMethod> IEnumerable<IMethod>.GetEnumerator()
|
||||
IEnumerator<IMethodSection> IEnumerable<IMethodSection>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IMethod;
|
||||
yield return BaseGet(i) as IMethodSection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Umbraco.Core.Configuration.BaseRest
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
IMethod IExtension.this[string index]
|
||||
IMethodSection IExtension.this[string index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
public interface IBaseRest
|
||||
public interface IBaseRestSection
|
||||
{
|
||||
IExtensionsCollection Items { get; }
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
string Type { get; }
|
||||
|
||||
IMethod this[string index] { get; }
|
||||
IMethodSection this[string index] { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
public interface IMethod
|
||||
public interface IMethodSection
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
internal class MethodElement : ConfigurationElement, IMethod
|
||||
internal class MethodElement : ConfigurationElement, IMethodSection
|
||||
{
|
||||
const string KeyName = "name";
|
||||
const string KeyAllowAll = "allowAll";
|
||||
|
||||
Reference in New Issue
Block a user