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:
Shannon
2013-09-16 17:39:45 +10:00
parent bd644bc707
commit b043ee577f
85 changed files with 540 additions and 520 deletions

View File

@@ -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; }
}

View File

@@ -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]; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IBaseRest
public interface IBaseRestSection
{
IExtensionsCollection Items { get; }

View File

@@ -6,6 +6,6 @@
string Type { get; }
IMethod this[string index] { get; }
IMethodSection this[string index] { get; }
}
}

View File

@@ -1,6 +1,6 @@
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IMethod
public interface IMethodSection
{
string Name { get; }

View File

@@ -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";

View File

@@ -8,7 +8,6 @@ namespace Umbraco.Core.Configuration
{
public class FileSystemProvidersSection : ConfigurationSection
{
private const string PROVIDERS_KEY = "providers";
[ConfigurationProperty("", IsDefaultCollection = true, IsRequired = true)]
public FileSystemProviderElementCollection Providers

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using Umbraco.Core.Configuration.BaseRest;
using Umbraco.Core.Configuration.UmbracoSettings;
@@ -24,57 +26,63 @@ namespace Umbraco.Core.Configuration
#endregion
//#region Extensible settings
#region Extensible settings
//TODO: Need to think about this... it seems nicer to do this than having giant nested access to the configuration
// sections, BUT we don't want to attribute the interfaces. We can make IUmbracoConfigurationSection plugins and then search for the matching
// one based on the specified interface ?
private static readonly ConcurrentDictionary<Type, IUmbracoConfigurationSection> Sections = new ConcurrentDictionary<Type, IUmbracoConfigurationSection>();
//private static readonly ConcurrentDictionary<Type, IUmbracoConfigurationSection> Sections = new ConcurrentDictionary<Type, IUmbracoConfigurationSection>();
/// <summary>
/// Gets the specified UmbracoConfigurationSection.
/// </summary>
/// <typeparam name="T">The type of the UmbracoConfigurationSectiont.</typeparam>
/// <returns>The UmbracoConfigurationSection of the specified type.</returns>
public static T For<T>(System.Configuration.Configuration config = null)
where T : IUmbracoConfigurationSection
{
var sectionType = typeof(T);
return (T)Sections.GetOrAdd(sectionType, type =>
{
//if there is no entry for this type
var configurationSections = PluginManager.Current.ResolveUmbracoConfigurationSections();
var implementationType = configurationSections.FirstOrDefault(TypeHelper.IsTypeAssignableFrom<T>);
if (implementationType == null)
{
throw new InvalidOperationException("Could not find an implementation for " + typeof(T));
}
///// <summary>
///// Gets the specified UmbracoConfigurationSection.
///// </summary>
///// <typeparam name="T">The type of the UmbracoConfigurationSectiont.</typeparam>
///// <returns>The UmbracoConfigurationSection of the specified type.</returns>
//public static T For<T>()
// where T : IUmbracoConfigurationSection
//{
// var sectionType = typeof(T);
// return (T)Sections.GetOrAdd(sectionType, type =>
// {
// var attr = sectionType.GetCustomAttribute<ConfigurationKeyAttribute>(false);
// if (attr == null)
// throw new InvalidOperationException(string.Format("Type \"{0}\" is missing attribute ConfigurationKeyAttribute.", sectionType.FullName));
var attr = implementationType.GetCustomAttribute<ConfigurationKeyAttribute>(false);
if (attr == null)
throw new InvalidOperationException(string.Format("Type \"{0}\" is missing attribute ConfigurationKeyAttribute.", sectionType.FullName));
// var sectionKey = attr.ConfigurationKey;
// if (string.IsNullOrWhiteSpace(sectionKey))
// throw new InvalidOperationException(string.Format("Type \"{0}\" ConfigurationKeyAttribute value is null or empty.", sectionType.FullName));
var sectionKey = attr.ConfigurationKey;
if (string.IsNullOrWhiteSpace(sectionKey))
throw new InvalidOperationException(string.Format("Type \"{0}\" {1} value is null or empty.", sectionType.FullName, typeof(ConfigurationKeyAttribute)));
// var section = GetSection(sectionType, sectionKey);
var section = GetSection(sectionType, sectionKey, config);
// return (T)section;
// });
//}
return (T)section;
});
}
//private static IUmbracoConfigurationSection GetSection(Type sectionType, string key)
//{
// if (TypeHelper.IsTypeAssignableFrom<IUmbracoConfigurationSection>(sectionType) == false)
// {
// throw new ArgumentException(string.Format(
// "Type \"{0}\" does not inherit from UmbracoConfigurationSection.", sectionType.FullName), "sectionType");
// }
private static IUmbracoConfigurationSection GetSection(Type sectionType, string key, System.Configuration.Configuration config = null)
{
var section = config == null
? ConfigurationManager.GetSection(key)
: config.GetSection(key);
// var section = ConfigurationManager.GetSection(key);
if (section == null)
{
throw new KeyNotFoundException("Could not find/load config section: " + key);
}
// if (section != null && section.GetType() != sectionType)
// throw new InvalidCastException(string.Format("Section at key \"{0}\" is of type \"{1}\" and not \"{2}\".",
// key, section.GetType().FullName, sectionType.FullName));
var result = section as IUmbracoConfigurationSection;
if (result == null)
{
throw new InvalidOperationException(string.Format("The section type requested '{0}' does not match the resulting section type '{1}", sectionType, section.GetType()));
}
return result;
}
// return section as IUmbracoConfigurationSection;
//}
//#endregion
#endregion
/// <summary>
/// Default constructor
@@ -83,13 +91,23 @@ namespace Umbraco.Core.Configuration
{
if (UmbracoSettings == null)
{
var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettings;
var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettingsSection;
if (umbracoSettings == null)
{
LogHelper.Warn<UmbracoConfiguration>("Could not load the IUmbracoSettings from config file!");
LogHelper.Warn<UmbracoConfiguration>("Could not load the " + typeof(IUmbracoSettingsSection) + " from config file!");
}
UmbracoSettings = umbracoSettings;
}
if (BaseRestExtensions == null)
{
var baseRestExtensions = ConfigurationManager.GetSection("umbracoConfiguration/BaseRestExtensions") as IBaseRestSection;
if (baseRestExtensions == null)
{
LogHelper.Warn<UmbracoConfiguration>("Could not load the " + typeof(IBaseRestSection) + " from config file!");
}
BaseRestExtensions = baseRestExtensions;
}
}
/// <summary>
@@ -97,7 +115,7 @@ namespace Umbraco.Core.Configuration
/// </summary>
/// <param name="umbracoSettings"></param>
/// <param name="baseRestSettings"></param>
public UmbracoConfiguration(IUmbracoSettings umbracoSettings, IBaseRest baseRestSettings)
public UmbracoConfiguration(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings)
{
UmbracoSettings = umbracoSettings;
BaseRestExtensions = baseRestSettings;
@@ -106,14 +124,14 @@ namespace Umbraco.Core.Configuration
/// <summary>
/// Gets the IUmbracoSettings
/// </summary>
public IUmbracoSettings UmbracoSettings
public IUmbracoSettingsSection UmbracoSettings
{
get;
//This is purely for setting for Unit tests ONLY
internal set;
}
public IBaseRest BaseRestExtensions { get; private set; }
public IBaseRestSection BaseRestExtensions { get; private set; }
//TODO: Add other configurations here !
}

View File

@@ -2,7 +2,9 @@
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Represents an Umbraco configuration section which can be used to pass to UmbracoConfiguration.For{T}
/// </summary>
public interface IUmbracoConfigurationSection
{
@@ -19,7 +21,7 @@ namespace Umbraco.Core.Configuration
/// <para>The <c>UmbracoSettings.For{T}</c> method will return a section, either one that
/// is in the configuration file, or a section that was created with default values.</para>
/// </remarks>
public abstract class UmbracoConfigurationSection : ConfigurationSection
public abstract class UmbracoConfigurationSection : ConfigurationSection, IUmbracoConfigurationSection
{
/// <summary>
/// Gets a value indicating whether the section actually is in the configuration file.

View File

@@ -3,6 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
[ConfigurationKey("umbracoConfiguration/settings/content")]
internal class ContentElement : ConfigurationElement, IContentSection
{
[ConfigurationProperty("imaging")]
@@ -309,7 +310,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return Imaging.ImageTagAllowedAttributes; }
}
IEnumerable<IContentImagingAutoFillUploadField> IContentSection.ImageAutoFillProperties
IEnumerable<IImagingAutoFillUploadField> IContentSection.ImageAutoFillProperties
{
get { return Imaging.ImageAutoFillProperties; }
}

View File

@@ -29,11 +29,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
private ContentImagingAutoFillPropertiesCollection _defaultImageAutoFill;
private ImagingAutoFillPropertiesCollection _defaultImageAutoFill;
[ConfigurationCollection(typeof(ContentImagingAutoFillPropertiesCollection), AddItemName = "uploadField")]
[ConfigurationCollection(typeof(ImagingAutoFillPropertiesCollection), AddItemName = "uploadField")]
[ConfigurationProperty("autoFillImageProperties", IsDefaultCollection = true)]
internal ContentImagingAutoFillPropertiesCollection ImageAutoFillProperties
internal ImagingAutoFillPropertiesCollection ImageAutoFillProperties
{
get
{
@@ -47,9 +47,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
var autoFill = this[prop] as ConfigurationElement;
if (autoFill != null && autoFill.ElementInformation.IsPresent == false)
{
_defaultImageAutoFill = new ContentImagingAutoFillPropertiesCollection
_defaultImageAutoFill = new ImagingAutoFillPropertiesCollection
{
new ContentImagingAutoFillUploadFieldElement
new ImagingAutoFillUploadFieldElement
{
Alias = "umbracoFile"
}
@@ -57,7 +57,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
return _defaultImageAutoFill;
}
return (ContentImagingAutoFillPropertiesCollection) base["autoFillImageProperties"];
return (ImagingAutoFillPropertiesCollection) base["autoFillImageProperties"];
}
}

View File

@@ -3,7 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class DeveloperElement : ConfigurationElement, IDeveloper
internal class DeveloperElement : ConfigurationElement, IDeveloperSection
{
private AppCodeFileExtensionsElement _default;
@@ -39,7 +39,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
IEnumerable<IFileExtension> IDeveloper.AppCodeFileExtensions
IEnumerable<IFileExtension> IDeveloperSection.AppCodeFileExtensions
{
get { return AppCodeFileExtensions.AppCodeFileExtensionsCollection; }
}

View File

@@ -3,7 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class DistributedCallElement : ConfigurationElement, IDistributedCall
internal class DistributedCallElement : ConfigurationElement, IDistributedCallSection
{
[ConfigurationProperty("enable", DefaultValue = false)]
internal bool Enabled
@@ -30,17 +30,17 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (ServerCollection)base["servers"]; }
}
bool IDistributedCall.Enabled
bool IDistributedCallSection.Enabled
{
get { return Enabled; }
}
int IDistributedCall.UserId
int IDistributedCallSection.UserId
{
get { return UserId; }
}
IEnumerable<IServer> IDistributedCall.Servers
IEnumerable<IServer> IDistributedCallSection.Servers
{
get { return Servers; }
}

View File

@@ -3,7 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class HelpElement : ConfigurationElement, IHelp
internal class HelpElement : ConfigurationElement, IHelpSection
{
[ConfigurationProperty("defaultUrl", DefaultValue = "http://our.umbraco.org/wiki/umbraco-help/{0}/{1}")]
public string DefaultUrl
@@ -18,12 +18,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (LinksCollection) base[""]; }
}
string IHelp.DefaultUrl
string IHelpSection.DefaultUrl
{
get { return DefaultUrl; }
}
IEnumerable<ILink> IHelp.Links
IEnumerable<ILink> IHelpSection.Links
{
get { return Links; }
}

View File

@@ -12,7 +12,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
IEnumerable<string> ImageTagAllowedAttributes { get; }
IEnumerable<IContentImagingAutoFillUploadField> ImageAutoFillProperties { get; }
IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties { get; }
string ScriptFolderPath { get; }

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IDeveloper
public interface IDeveloperSection : IUmbracoConfigurationSection
{
IEnumerable<IFileExtension> AppCodeFileExtensions { get; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IDistributedCall
public interface IDistributedCallSection : IUmbracoConfigurationSection
{
bool Enabled { get; }

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IHelp
public interface IHelpSection : IUmbracoConfigurationSection
{
string DefaultUrl { get; }

View File

@@ -1,6 +1,6 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IContentImagingAutoFillUploadField
public interface IImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILogging
public interface ILoggingSection : IUmbracoConfigurationSection
{
bool AutoCleanLogs { get; }

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IProviders
public interface IProvidersSection : IUmbracoConfigurationSection
{
string DefaultBackOfficeUserProvider { get; }
}

View File

@@ -3,7 +3,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRepositories
public interface IRepositoriesSection : IUmbracoConfigurationSection
{
IEnumerable<IRepository> Repositories { get; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRequestHandler
public interface IRequestHandlerSection : IUmbracoConfigurationSection
{
bool UseDomainPrefixes { get; }

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScheduledTasks
public interface IScheduledTasksSection : IUmbracoConfigurationSection
{
IEnumerable<IScheduledTask> Tasks { get; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScripting
public interface IScriptingSection : IUmbracoConfigurationSection
{
IEnumerable<INotDynamicXmlDocument> NotDynamicXmlDocumentElements { get; }

View File

@@ -1,6 +1,6 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ISecurity
public interface ISecuritySection : IUmbracoConfigurationSection
{
bool KeepUserLoggedIn { get; }

View File

@@ -1,6 +1,6 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ITemplates
public interface ITemplatesSection : IUmbracoConfigurationSection
{
bool UseAspNetMasterPages { get; }

View File

@@ -1,33 +0,0 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IUmbracoSettings
{
IContentSection Content { get; }
ISecurity Security { get; }
IRequestHandler RequestHandler { get; }
ITemplates Templates { get; }
IDeveloper Developer { get; }
IViewstateMoverModule ViewstateMoverModule { get; }
ILogging Logging { get; }
IScheduledTasks ScheduledTasks { get; }
IDistributedCall DistributedCall { get; }
IRepositories PackageRepositories { get; }
IProviders Providers { get; }
IHelp Help { get; }
IWebRouting WebRouting { get; }
IScripting Scripting { get; }
}
}

View File

@@ -0,0 +1,33 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IUmbracoSettingsSection : IUmbracoConfigurationSection
{
IContentSection Content { get; }
ISecuritySection Security { get; }
IRequestHandlerSection RequestHandler { get; }
ITemplatesSection Templates { get; }
IDeveloperSection Developer { get; }
IViewStateMoverModuleSection ViewStateMoverModule { get; }
ILoggingSection Logging { get; }
IScheduledTasksSection ScheduledTasks { get; }
IDistributedCallSection DistributedCall { get; }
IRepositoriesSection PackageRepositories { get; }
IProvidersSection Providers { get; }
IHelpSection Help { get; }
IWebRoutingSection WebRouting { get; }
IScriptingSection Scripting { get; }
}
}

View File

@@ -1,6 +1,6 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IViewstateMoverModule
public interface IViewStateMoverModuleSection : IUmbracoConfigurationSection
{
bool Enable { get; }
}

View File

@@ -1,6 +1,6 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IWebRouting
public interface IWebRoutingSection : IUmbracoConfigurationSection
{
bool TrySkipIisCustomErrors { get; }

View File

@@ -1,37 +1,37 @@
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ContentImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable<IContentImagingAutoFillUploadField>
{
protected override ConfigurationElement CreateNewElement()
{
return new ContentImagingAutoFillUploadFieldElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ContentImagingAutoFillUploadFieldElement)element).Alias;
}
internal void Add(ContentImagingAutoFillUploadFieldElement item)
{
BaseAdd(item);
}
IEnumerator<IContentImagingAutoFillUploadField> IEnumerable<IContentImagingAutoFillUploadField>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IContentImagingAutoFillUploadField;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable<IImagingAutoFillUploadField>
{
protected override ConfigurationElement CreateNewElement()
{
return new ImagingAutoFillUploadFieldElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ImagingAutoFillUploadFieldElement)element).Alias;
}
internal void Add(ImagingAutoFillUploadFieldElement item)
{
BaseAdd(item);
}
IEnumerator<IImagingAutoFillUploadField> IEnumerable<IImagingAutoFillUploadField>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IImagingAutoFillUploadField;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@@ -1,91 +1,91 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ContentImagingAutoFillUploadFieldElement : ConfigurationElement, IContentImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default
/// </summary>
[ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
public string Alias
{
get { return (string)this["alias"]; }
set { this["alias"] = value; }
}
[ConfigurationProperty("widthFieldAlias")]
internal InnerTextConfigurationElement<string> WidthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["widthFieldAlias"],
//set the default
"umbracoWidth");
}
}
[ConfigurationProperty("heightFieldAlias")]
internal InnerTextConfigurationElement<string> HeightFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["heightFieldAlias"],
//set the default
"umbracoHeight");
}
}
[ConfigurationProperty("lengthFieldAlias")]
internal InnerTextConfigurationElement<string> LengthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["lengthFieldAlias"],
//set the default
"umbracoBytes");
}
}
[ConfigurationProperty("extensionFieldAlias")]
internal InnerTextConfigurationElement<string> ExtensionFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["extensionFieldAlias"],
//set the default
"umbracoExtension");
}
}
string IContentImagingAutoFillUploadField.Alias
{
get { return Alias; }
}
string IContentImagingAutoFillUploadField.WidthFieldAlias
{
get { return WidthFieldAlias; }
}
string IContentImagingAutoFillUploadField.HeightFieldAlias
{
get { return HeightFieldAlias; }
}
string IContentImagingAutoFillUploadField.LengthFieldAlias
{
get { return LengthFieldAlias; }
}
string IContentImagingAutoFillUploadField.ExtensionFieldAlias
{
get { return ExtensionFieldAlias; }
}
}
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ImagingAutoFillUploadFieldElement : ConfigurationElement, IImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default
/// </summary>
[ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
public string Alias
{
get { return (string)this["alias"]; }
set { this["alias"] = value; }
}
[ConfigurationProperty("widthFieldAlias")]
internal InnerTextConfigurationElement<string> WidthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["widthFieldAlias"],
//set the default
"umbracoWidth");
}
}
[ConfigurationProperty("heightFieldAlias")]
internal InnerTextConfigurationElement<string> HeightFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["heightFieldAlias"],
//set the default
"umbracoHeight");
}
}
[ConfigurationProperty("lengthFieldAlias")]
internal InnerTextConfigurationElement<string> LengthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["lengthFieldAlias"],
//set the default
"umbracoBytes");
}
}
[ConfigurationProperty("extensionFieldAlias")]
internal InnerTextConfigurationElement<string> ExtensionFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["extensionFieldAlias"],
//set the default
"umbracoExtension");
}
}
string IImagingAutoFillUploadField.Alias
{
get { return Alias; }
}
string IImagingAutoFillUploadField.WidthFieldAlias
{
get { return WidthFieldAlias; }
}
string IImagingAutoFillUploadField.HeightFieldAlias
{
get { return HeightFieldAlias; }
}
string IImagingAutoFillUploadField.LengthFieldAlias
{
get { return LengthFieldAlias; }
}
string IImagingAutoFillUploadField.ExtensionFieldAlias
{
get { return ExtensionFieldAlias; }
}
}
}

View File

@@ -3,7 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class LoggingElement : ConfigurationElement, ILogging
internal class LoggingElement : ConfigurationElement, ILoggingSection
{
[ConfigurationProperty("autoCleanLogs")]
@@ -93,47 +93,47 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
string ILogging.ExternalLoggerAssembly
string ILoggingSection.ExternalLoggerAssembly
{
get { return ExternalLogger.Assembly; }
}
string ILogging.ExternalLoggerType
string ILoggingSection.ExternalLoggerType
{
get { return ExternalLogger.Type; }
}
bool ILogging.ExternalLoggerEnableAuditTrail
bool ILoggingSection.ExternalLoggerEnableAuditTrail
{
get { return ExternalLogger.LogAuditTrail; }
}
bool ILogging.AutoCleanLogs
bool ILoggingSection.AutoCleanLogs
{
get { return AutoCleanLogs; }
}
bool ILogging.EnableLogging
bool ILoggingSection.EnableLogging
{
get { return EnableLogging; }
}
bool ILogging.EnableAsyncLogging
bool ILoggingSection.EnableAsyncLogging
{
get { return EnableAsyncLogging; }
}
int ILogging.CleaningMiliseconds
int ILoggingSection.CleaningMiliseconds
{
get { return CleaningMiliseconds; }
}
int ILogging.MaxLogAge
int ILoggingSection.MaxLogAge
{
get { return MaxLogAge; }
}
IEnumerable<ILogType> ILogging.DisabledLogTypes
IEnumerable<ILogType> ILoggingSection.DisabledLogTypes
{
get { return DisabledLogTypes; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ProvidersElement : ConfigurationElement, IProviders
internal class ProvidersElement : ConfigurationElement, IProvidersSection
{
[ConfigurationProperty("users")]
public UserProviderElement Users

View File

@@ -4,7 +4,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class RepositoriesElement : ConfigurationElement, IRepositories
internal class RepositoriesElement : ConfigurationElement, IRepositoriesSection
{
[ConfigurationCollection(typeof(RepositoriesCollection), AddItemName = "repository")]
@@ -15,7 +15,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
set { base[""] = value; }
}
IEnumerable<IRepository> IRepositories.Repositories
IEnumerable<IRepository> IRepositoriesSection.Repositories
{
get { return Repositories; }
}

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class RequestHandlerElement : ConfigurationElement, IRequestHandler
internal class RequestHandlerElement : ConfigurationElement, IRequestHandlerSection
{
[ConfigurationProperty("useDomainPrefixes")]
public InnerTextConfigurationElement<bool> UseDomainPrefixes
@@ -101,22 +101,22 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
bool IRequestHandler.UseDomainPrefixes
bool IRequestHandlerSection.UseDomainPrefixes
{
get { return UseDomainPrefixes; }
}
bool IRequestHandler.AddTrailingSlash
bool IRequestHandlerSection.AddTrailingSlash
{
get { return AddTrailingSlash; }
}
bool IRequestHandler.RemoveDoubleDashes
bool IRequestHandlerSection.RemoveDoubleDashes
{
get { return UrlReplacing.RemoveDoubleDashes; }
}
IEnumerable<IChar> IRequestHandler.CharCollection
IEnumerable<IChar> IRequestHandlerSection.CharCollection
{
get { return UrlReplacing.CharCollection; }
}

View File

@@ -3,7 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ScheduledTasksElement : ConfigurationElement, IScheduledTasks
internal class ScheduledTasksElement : ConfigurationElement, IScheduledTasksSection
{
[ConfigurationCollection(typeof(ScheduledTasksCollection), AddItemName = "task")]
[ConfigurationProperty("", IsDefaultCollection = true)]
@@ -12,7 +12,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (ScheduledTasksCollection)base[""]; }
}
IEnumerable<IScheduledTask> IScheduledTasks.Tasks
IEnumerable<IScheduledTask> IScheduledTasksSection.Tasks
{
get { return Tasks; }
}

View File

@@ -3,7 +3,7 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ScriptingElement : ConfigurationElement, IScripting
internal class ScriptingElement : ConfigurationElement, IScriptingSection
{
[ConfigurationProperty("razor")]
internal RazorElement Razor
@@ -11,12 +11,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (RazorElement) base["razor"]; }
}
IEnumerable<INotDynamicXmlDocument> IScripting.NotDynamicXmlDocumentElements
IEnumerable<INotDynamicXmlDocument> IScriptingSection.NotDynamicXmlDocumentElements
{
get { return Razor.NotDynamicXmlDocumentElements; }
}
IEnumerable<IRazorStaticMapping> IScripting.DataTypeModelStaticMappings
IEnumerable<IRazorStaticMapping> IScriptingSection.DataTypeModelStaticMappings
{
get { return Razor.DataTypeModelStaticMappings; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class SecurityElement : ConfigurationElement, ISecurity
internal class SecurityElement : ConfigurationElement, ISecuritySection
{
[ConfigurationProperty("keepUserLoggedIn")]
internal InnerTextConfigurationElement<bool> KeepUserLoggedIn
@@ -52,22 +52,22 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
bool ISecurity.KeepUserLoggedIn
bool ISecuritySection.KeepUserLoggedIn
{
get { return KeepUserLoggedIn; }
}
bool ISecurity.HideDisabledUsersInBackoffice
bool ISecuritySection.HideDisabledUsersInBackoffice
{
get { return HideDisabledUsersInBackoffice; }
}
string ISecurity.AuthCookieName
string ISecuritySection.AuthCookieName
{
get { return AuthCookieName; }
}
string ISecurity.AuthCookieDomain
string ISecuritySection.AuthCookieDomain
{
get { return AuthCookieDomain; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class TemplatesElement : ConfigurationElement, ITemplates
internal class TemplatesElement : ConfigurationElement, ITemplatesSection
{
[ConfigurationProperty("useAspNetMasterPages")]
internal InnerTextConfigurationElement<bool> UseAspNetMasterPages
@@ -52,22 +52,22 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
bool ITemplates.UseAspNetMasterPages
bool ITemplatesSection.UseAspNetMasterPages
{
get { return UseAspNetMasterPages; }
}
bool ITemplates.EnableSkinSupport
bool ITemplatesSection.EnableSkinSupport
{
get { return EnableSkinSupport; }
}
RenderingEngine ITemplates.DefaultRenderingEngine
RenderingEngine ITemplatesSection.DefaultRenderingEngine
{
get { return DefaultRenderingEngine; }
}
bool ITemplates.EnableTemplateFolders
bool ITemplatesSection.EnableTemplateFolders
{
get { return EnableTemplateFolders; }
}

View File

@@ -3,18 +3,9 @@ using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public class UmbracoSettingsSection : ConfigurationSection, IUmbracoSettings
[ConfigurationKey("umbracoConfiguration/settings")]
public class UmbracoSettingsSection : ConfigurationSection, IUmbracoSettingsSection
{
///// <summary>
///// Get the current settings
///// </summary>
//public static UmbracoSettings Current
//{
// get { return (UmbracoSettings) ConfigurationManager.GetSection("umbracoConfiguration/settings"); }
//}
[ConfigurationProperty("content")]
internal ContentElement Content
{
@@ -129,72 +120,72 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (ScriptingElement)this["scripting"]; }
}
IContentSection IUmbracoSettings.Content
IContentSection IUmbracoSettingsSection.Content
{
get { return Content; }
}
ISecurity IUmbracoSettings.Security
ISecuritySection IUmbracoSettingsSection.Security
{
get { return Security; }
}
IRequestHandler IUmbracoSettings.RequestHandler
IRequestHandlerSection IUmbracoSettingsSection.RequestHandler
{
get { return RequestHandler; }
}
ITemplates IUmbracoSettings.Templates
ITemplatesSection IUmbracoSettingsSection.Templates
{
get { return Templates; }
}
IDeveloper IUmbracoSettings.Developer
IDeveloperSection IUmbracoSettingsSection.Developer
{
get { return Developer; }
}
IViewstateMoverModule IUmbracoSettings.ViewstateMoverModule
IViewStateMoverModuleSection IUmbracoSettingsSection.ViewStateMoverModule
{
get { return ViewstateMoverModule; }
}
ILogging IUmbracoSettings.Logging
ILoggingSection IUmbracoSettingsSection.Logging
{
get { return Logging; }
}
IScheduledTasks IUmbracoSettings.ScheduledTasks
IScheduledTasksSection IUmbracoSettingsSection.ScheduledTasks
{
get { return ScheduledTasks; }
}
IDistributedCall IUmbracoSettings.DistributedCall
IDistributedCallSection IUmbracoSettingsSection.DistributedCall
{
get { return DistributedCall; }
}
IRepositories IUmbracoSettings.PackageRepositories
IRepositoriesSection IUmbracoSettingsSection.PackageRepositories
{
get { return PackageRepositories; }
}
IProviders IUmbracoSettings.Providers
IProvidersSection IUmbracoSettingsSection.Providers
{
get { return Providers; }
}
IHelp IUmbracoSettings.Help
IHelpSection IUmbracoSettingsSection.Help
{
get { return Help; }
}
IWebRouting IUmbracoSettings.WebRouting
IWebRoutingSection IUmbracoSettingsSection.WebRouting
{
get { return WebRouting; }
}
IScripting IUmbracoSettings.Scripting
IScriptingSection IUmbracoSettingsSection.Scripting
{
get { return Scripting; }
}

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ViewstateMoverModuleElement : ConfigurationElement, IViewstateMoverModule
internal class ViewstateMoverModuleElement : ConfigurationElement, IViewStateMoverModuleSection
{
[ConfigurationProperty("enable", DefaultValue = false)]
public bool Enable

View File

@@ -2,7 +2,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class WebRoutingElement : ConfigurationElement, IWebRouting
internal class WebRoutingElement : ConfigurationElement, IWebRoutingSection
{
[ConfigurationProperty("trySkipIisCustomErrors", DefaultValue = "false")]
public bool TrySkipIisCustomErrors