Simplifies more of the interface config collection to reduce nesting.

This commit is contained in:
Shannon
2013-09-16 16:16:42 +10:00
parent 09b68a75be
commit bd644bc707
44 changed files with 356 additions and 401 deletions

View File

@@ -0,0 +1,23 @@
namespace Umbraco.Core.Configuration
{
/// <summary>
/// This is used to supply optional/default values when using InnerTextConfigurationElement
/// </summary>
/// <typeparam name="T"></typeparam>
internal class OptionalInnerTextConfigurationElement<T> : InnerTextConfigurationElement<T>
{
private readonly InnerTextConfigurationElement<T> _wrapped;
private readonly T _defaultValue;
public OptionalInnerTextConfigurationElement(InnerTextConfigurationElement<T> wrapped, T defaultValue)
{
_wrapped = wrapped;
_defaultValue = defaultValue;
}
public override T Value
{
get { return string.IsNullOrEmpty(_wrapped.RawValue) ? _defaultValue : _wrapped.Value; }
}
}
}