diff --git a/src/Umbraco.Abstractions/Collections/ConcurrentHashSet.cs b/src/Umbraco.Abstractions/Collections/ConcurrentHashSet.cs
index 54367ed588..c4dba51acd 100644
--- a/src/Umbraco.Abstractions/Collections/ConcurrentHashSet.cs
+++ b/src/Umbraco.Abstractions/Collections/ConcurrentHashSet.cs
@@ -70,7 +70,23 @@ namespace Umbraco.Core.Collections
/// The number of elements contained in the .
///
/// 2
- public int Count => GetThreadSafeClone().Count;
+ public int Count
+ {
+ get
+ {
+ try
+ {
+ _instanceLocker.EnterReadLock();
+ return _innerSet.Count;
+ }
+ finally
+ {
+ if (_instanceLocker.IsReadLockHeld)
+ _instanceLocker.ExitReadLock();
+ }
+
+ }
+ }
///
/// Gets a value indicating whether the is read-only.
@@ -105,8 +121,7 @@ namespace Umbraco.Core.Collections
///
public bool TryAdd(T item)
{
- var clone = GetThreadSafeClone();
- if (clone.Contains(item)) return false;
+ if (Contains(item)) return false;
try
{
_instanceLocker.EnterWriteLock();
@@ -150,7 +165,16 @@ namespace Umbraco.Core.Collections
/// The object to locate in the .
public bool Contains(T item)
{
- return GetThreadSafeClone().Contains(item);
+ try
+ {
+ _instanceLocker.EnterReadLock();
+ return _innerSet.Contains(item);
+ }
+ finally
+ {
+ if (_instanceLocker.IsReadLockHeld)
+ _instanceLocker.ExitReadLock();
+ }
}
///
@@ -168,13 +192,13 @@ namespace Umbraco.Core.Collections
HashSet clone = null;
try
{
- _instanceLocker.EnterWriteLock();
+ _instanceLocker.EnterReadLock();
clone = new HashSet(_innerSet, _innerSet.Comparer);
}
finally
{
- if (_instanceLocker.IsWriteLockHeld)
- _instanceLocker.ExitWriteLock();
+ if (_instanceLocker.IsReadLockHeld)
+ _instanceLocker.ExitReadLock();
}
return clone;
}
diff --git a/src/Umbraco.Abstractions/Collections/ObservableDictionary.cs b/src/Umbraco.Abstractions/Collections/ObservableDictionary.cs
index 40269aa4eb..c6aedab377 100644
--- a/src/Umbraco.Abstractions/Collections/ObservableDictionary.cs
+++ b/src/Umbraco.Abstractions/Collections/ObservableDictionary.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Collections
{
@@ -26,7 +27,7 @@ namespace Umbraco.Core.Collections
/// The equality comparer to use when comparing keys, or null to use the default comparer.
public ObservableDictionary(Func keySelector, IEqualityComparer equalityComparer = null)
{
- KeySelector = keySelector ?? throw new ArgumentException("keySelector");
+ KeySelector = keySelector ?? throw new ArgumentException(nameof(keySelector));
Indecies = new Dictionary(equalityComparer);
}
@@ -36,7 +37,7 @@ namespace Umbraco.Core.Collections
{
var key = KeySelector(item);
if (Indecies.ContainsKey(key))
- throw new DuplicateKeyException(key.ToString());
+ throw new ArgumentException($"An element with the same key '{key}' already exists in the dictionary.", nameof(item));
if (index != Count)
{
@@ -91,7 +92,7 @@ namespace Umbraco.Core.Collections
{
//confirm key matches
if (!KeySelector(value).Equals(key))
- throw new InvalidOperationException("Key of new value does not match");
+ throw new InvalidOperationException("Key of new value does not match.");
if (!Indecies.ContainsKey(key))
{
@@ -118,7 +119,7 @@ namespace Umbraco.Core.Collections
//confirm key matches
if (!KeySelector(value).Equals(key))
- throw new InvalidOperationException("Key of new value does not match");
+ throw new InvalidOperationException("Key of new value does not match.");
this[Indecies[key]] = value;
return true;
@@ -155,12 +156,12 @@ namespace Umbraco.Core.Collections
{
if (!Indecies.ContainsKey(currentKey))
{
- throw new InvalidOperationException("No item with the key " + currentKey + "was found in the collection");
+ throw new InvalidOperationException($"No item with the key '{currentKey}' was found in the dictionary.");
}
if (ContainsKey(newKey))
{
- throw new DuplicateKeyException(newKey.ToString());
+ throw new ArgumentException($"An element with the same key '{newKey}' already exists in the dictionary.", nameof(newKey));
}
var currentIndex = Indecies[currentKey];
@@ -234,16 +235,5 @@ namespace Umbraco.Core.Collections
}
#endregion
-
- internal class DuplicateKeyException : Exception
- {
- public DuplicateKeyException(string key)
- : base("Attempted to insert duplicate key \"" + key + "\" in collection.")
- {
- Key = key;
- }
-
- public string Key { get; }
- }
}
}
diff --git a/src/Umbraco.Abstractions/Composing/TypeLoader.cs b/src/Umbraco.Abstractions/Composing/TypeLoader.cs
index d2f203e112..6feb915f4a 100644
--- a/src/Umbraco.Abstractions/Composing/TypeLoader.cs
+++ b/src/Umbraco.Abstractions/Composing/TypeLoader.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
+using System.Runtime.Serialization;
using System.Text;
using System.Threading;
using Umbraco.Core.Cache;
@@ -816,11 +817,44 @@ namespace Umbraco.Core.Composing
}
///
- /// Represents the error that occurs when a type was not found in the cache type
- /// list with the specified TypeResolutionKind.
+ /// Represents the error that occurs when a type was not found in the cache type list with the specified TypeResolutionKind.
///
+ ///
+ [Serializable]
internal class CachedTypeNotFoundInFileException : Exception
- { }
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CachedTypeNotFoundInFileException()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public CachedTypeNotFoundInFileException(string message)
+ : base(message)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public CachedTypeNotFoundInFileException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected CachedTypeNotFoundInFileException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
+ }
#endregion
}
diff --git a/src/Umbraco.Abstractions/EnumExtensions.cs b/src/Umbraco.Abstractions/EnumExtensions.cs
index 1443a27876..b2e5f32c9a 100644
--- a/src/Umbraco.Abstractions/EnumExtensions.cs
+++ b/src/Umbraco.Abstractions/EnumExtensions.cs
@@ -41,5 +41,43 @@ namespace Umbraco.Core
return (num & nums) > 0;
}
+
+ ///
+ /// Sets a flag of the given input enum
+ ///
+ ///
+ /// Enum to set flag of
+ /// Flag to set
+ /// A new enum with the flag set
+ public static T SetFlag(this T input, T flag)
+ where T : Enum
+ {
+ var i = Convert.ToUInt64(input);
+ var f = Convert.ToUInt64(flag);
+
+ // bitwise OR to set flag f of enum i
+ var result = i | f;
+
+ return (T)Enum.ToObject(typeof(T), result);
+ }
+
+ ///
+ /// Unsets a flag of the given input enum
+ ///
+ ///
+ /// Enum to unset flag of
+ /// Flag to unset
+ /// A new enum with the flag unset
+ public static T UnsetFlag(this T input, T flag)
+ where T : Enum
+ {
+ var i = Convert.ToUInt64(input);
+ var f = Convert.ToUInt64(flag);
+
+ // bitwise AND combined with bitwise complement to unset flag f of enum i
+ var result = i & ~f;
+
+ return (T)Enum.ToObject(typeof(T), result);
+ }
}
}
diff --git a/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs b/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs
index 90cc20c404..037d35d0ee 100644
--- a/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs
@@ -1,16 +1,24 @@
using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Exceptions
{
///
- /// The exception that is thrown when a null reference, or an empty argument,
- /// is passed to a method that does not accept it as a valid argument.
+ /// The exception that is thrown when a null reference, or an empty argument, is passed to a method that does not accept it as a valid argument.
///
+ ///
+ [Obsolete("Throw an ArgumentNullException when the parameter is null or an ArgumentException when its empty instead.")]
+ [Serializable]
public class ArgumentNullOrEmptyException : ArgumentNullException
{
///
- /// Initializes a new instance of the class
- /// with the name of the parameter that caused this exception.
+ /// Initializes a new instance of the class.
+ ///
+ public ArgumentNullOrEmptyException()
+ { }
+
+ ///
+ /// Initializes a new instance of the class with the name of the parameter that caused this exception.
///
/// The named of the parameter that caused the exception.
public ArgumentNullOrEmptyException(string paramName)
@@ -18,13 +26,30 @@ namespace Umbraco.Core.Exceptions
{ }
///
- /// Initializes a new instance of the class
- /// with a specified error message and the name of the parameter that caused this exception.
+ /// Initializes a new instance of the class with a specified error message and the name of the parameter that caused this exception.
///
/// The named of the parameter that caused the exception.
/// A message that describes the error.
public ArgumentNullOrEmptyException(string paramName, string message)
: base(paramName, message)
{ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for this exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public ArgumentNullOrEmptyException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The object that holds the serialized object data.
+ /// An object that describes the source or destination of the serialized data.
+ protected ArgumentNullOrEmptyException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
}
}
diff --git a/src/Umbraco.Abstractions/Exceptions/AuthorizationException.cs b/src/Umbraco.Abstractions/Exceptions/AuthorizationException.cs
index 955fec270b..b87a8da8b8 100644
--- a/src/Umbraco.Abstractions/Exceptions/AuthorizationException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/AuthorizationException.cs
@@ -1,14 +1,45 @@
using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Exceptions
{
+ ///
+ /// The exception that is thrown when authorization failed.
+ ///
+ ///
+ [Serializable]
public class AuthorizationException : Exception
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
public AuthorizationException()
{ }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
public AuthorizationException(string message)
: base(message)
{ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public AuthorizationException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected AuthorizationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
}
}
diff --git a/src/Umbraco.Abstractions/Exceptions/BootFailedException.cs b/src/Umbraco.Abstractions/Exceptions/BootFailedException.cs
index c3262d26c6..e8ffe1d2e9 100644
--- a/src/Umbraco.Abstractions/Exceptions/BootFailedException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/BootFailedException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Core.Exceptions
@@ -6,6 +7,8 @@ namespace Umbraco.Core.Exceptions
///
/// An exception that is thrown if the Umbraco application cannot boot.
///
+ ///
+ [Serializable]
public class BootFailedException : Exception
{
///
@@ -14,27 +17,47 @@ namespace Umbraco.Core.Exceptions
public const string DefaultMessage = "Boot failed: Umbraco cannot run. See Umbraco's log file for more details.";
///
- /// Initializes a new instance of the class with a specified error message.
+ /// Initializes a new instance of the class.
///
- /// The message that describes the error.
+ public BootFailedException()
+ { }
+
+ ///
+ /// Initializes a new instance of the class with a specified error message.
+ ///
+ /// The message that describes the error.
public BootFailedException(string message)
: base(message)
{ }
///
- /// Initializes a new instance of the class with a specified error message
+ /// Initializes a new instance of the class with a specified error message
/// and a reference to the inner exception which is the cause of this exception.
///
- /// The message that describes the error.
- /// The inner exception, or null.
- public BootFailedException(string message, Exception inner)
- : base(message, inner)
+ /// The message that describes the error.
+ /// The inner exception, or null.
+ public BootFailedException(string message, Exception innerException)
+ : base(message, innerException)
{ }
///
- /// Rethrows a captured .
+ /// Initializes a new instance of the class.
///
- /// The exception can be null, in which case a default message is used.
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected BootFailedException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
+
+ ///
+ /// Rethrows a captured .
+ ///
+ /// The boot failed exception.
+ ///
+ ///
+ ///
+ /// The exception can be null, in which case a default message is used.
+ ///
public static void Rethrow(BootFailedException bootFailedException)
{
if (bootFailedException == null)
diff --git a/src/Umbraco.Abstractions/Exceptions/ConnectionException.cs b/src/Umbraco.Abstractions/Exceptions/ConnectionException.cs
deleted file mode 100644
index 7b38058ec2..0000000000
--- a/src/Umbraco.Abstractions/Exceptions/ConnectionException.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Umbraco.Core.Exceptions
-{
- public class ConnectionException : Exception
- {
- public ConnectionException(string message, Exception innerException) : base(message, innerException)
- {
-
- }
- }
-}
diff --git a/src/Umbraco.Abstractions/Exceptions/DataOperationException.cs b/src/Umbraco.Abstractions/Exceptions/DataOperationException.cs
index b2025ba8f6..a48fdbc721 100644
--- a/src/Umbraco.Abstractions/Exceptions/DataOperationException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/DataOperationException.cs
@@ -1,21 +1,98 @@
using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Exceptions
{
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
public class DataOperationException : Exception
+ where T : Enum
{
+ ///
+ /// Gets the operation.
+ ///
+ ///
+ /// The operation.
+ ///
+ ///
+ /// This object should be serializable to prevent a to be thrown.
+ ///
public T Operation { get; private set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DataOperationException()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public DataOperationException(string message)
+ : base(message)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public DataOperationException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The operation.
+ public DataOperationException(T operation)
+ : this(operation, "Data operation exception: " + operation)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The operation.
+ /// The message.
public DataOperationException(T operation, string message)
: base(message)
{
Operation = operation;
}
- public DataOperationException(T operation)
- : base("Data operation exception: " + operation)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ /// info
+ protected DataOperationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
- Operation = operation;
+ Operation = (T)Enum.Parse(typeof(T), info.GetString(nameof(Operation)));
+ }
+
+ ///
+ /// When overridden in a derived class, sets the with information about the exception.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ /// info
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ {
+ throw new ArgumentNullException(nameof(info));
+ }
+
+ info.AddValue(nameof(Operation), Enum.GetName(typeof(T), Operation));
+
+ base.GetObjectData(info, context);
}
}
}
diff --git a/src/Umbraco.Abstractions/Exceptions/InvalidCompositionException.cs b/src/Umbraco.Abstractions/Exceptions/InvalidCompositionException.cs
index 692bd6124e..684e23b020 100644
--- a/src/Umbraco.Abstractions/Exceptions/InvalidCompositionException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/InvalidCompositionException.cs
@@ -1,44 +1,126 @@
using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Exceptions
{
+ ///
+ /// The exception that is thrown when a composition is invalid.
+ ///
+ ///
+ [Serializable]
public class InvalidCompositionException : Exception
{
- public InvalidCompositionException(string contentTypeAlias, string addedCompositionAlias, string[] propertyTypeAliass)
- {
- ContentTypeAlias = contentTypeAlias;
- AddedCompositionAlias = addedCompositionAlias;
- PropertyTypeAliases = propertyTypeAliass;
- }
+ ///
+ /// Gets the content type alias.
+ ///
+ ///
+ /// The content type alias.
+ ///
+ public string ContentTypeAlias { get; }
- public InvalidCompositionException(string contentTypeAlias, string[] propertyTypeAliass)
- {
- ContentTypeAlias = contentTypeAlias;
- PropertyTypeAliases = propertyTypeAliass;
- }
+ ///
+ /// Gets the added composition alias.
+ ///
+ ///
+ /// The added composition alias.
+ ///
+ public string AddedCompositionAlias { get; }
- public string ContentTypeAlias { get; private set; }
+ ///
+ /// Gets the property type aliases.
+ ///
+ ///
+ /// The property type aliases.
+ ///
+ public string[] PropertyTypeAliases { get; }
- public string AddedCompositionAlias { get; private set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public InvalidCompositionException()
+ { }
- public string[] PropertyTypeAliases { get; private set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The content type alias.
+ /// The property type aliases.
+ public InvalidCompositionException(string contentTypeAlias, string[] propertyTypeAliases)
+ : this(contentTypeAlias, null, propertyTypeAliases)
+ { }
- public override string Message
- {
- get
- {
- return string.IsNullOrWhiteSpace(AddedCompositionAlias)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The content type alias.
+ /// The added composition alias.
+ /// The property type aliases.
+ public InvalidCompositionException(string contentTypeAlias, string addedCompositionAlias, string[] propertyTypeAliases)
+ : this(addedCompositionAlias.IsNullOrWhiteSpace()
? string.Format(
"ContentType with alias '{0}' has an invalid composition " +
"and there was a conflict on the following PropertyTypes: '{1}'. " +
"PropertyTypes must have a unique alias across all Compositions in order to compose a valid ContentType Composition.",
- ContentTypeAlias, string.Join(", ", PropertyTypeAliases))
+ contentTypeAlias, string.Join(", ", propertyTypeAliases))
: string.Format(
"ContentType with alias '{0}' was added as a Composition to ContentType with alias '{1}', " +
"but there was a conflict on the following PropertyTypes: '{2}'. " +
"PropertyTypes must have a unique alias across all Compositions in order to compose a valid ContentType Composition.",
- AddedCompositionAlias, ContentTypeAlias, string.Join(", ", PropertyTypeAliases));
+ addedCompositionAlias, contentTypeAlias, string.Join(", ", propertyTypeAliases)))
+ {
+ ContentTypeAlias = contentTypeAlias;
+ AddedCompositionAlias = addedCompositionAlias;
+ PropertyTypeAliases = propertyTypeAliases;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public InvalidCompositionException(string message)
+ : base(message)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public InvalidCompositionException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected InvalidCompositionException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ ContentTypeAlias = info.GetString(nameof(ContentTypeAlias));
+ AddedCompositionAlias = info.GetString(nameof(AddedCompositionAlias));
+ PropertyTypeAliases = (string[])info.GetValue(nameof(PropertyTypeAliases), typeof(string[]));
+ }
+
+ ///
+ /// When overridden in a derived class, sets the with information about the exception.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ /// info
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ {
+ throw new ArgumentNullException(nameof(info));
}
+
+ info.AddValue(nameof(ContentTypeAlias), ContentTypeAlias);
+ info.AddValue(nameof(AddedCompositionAlias), AddedCompositionAlias);
+ info.AddValue(nameof(PropertyTypeAliases), PropertyTypeAliases);
+
+ base.GetObjectData(info, context);
}
}
}
diff --git a/src/Umbraco.Abstractions/Exceptions/PanicException.cs b/src/Umbraco.Abstractions/Exceptions/PanicException.cs
index 25164dbe32..75edf7fd73 100644
--- a/src/Umbraco.Abstractions/Exceptions/PanicException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/PanicException.cs
@@ -4,25 +4,42 @@ using System.Runtime.Serialization;
namespace Umbraco.Core.Exceptions
{
///
- /// Internal exception that in theory should never ben thrown, it is only thrown in circumstances that should never happen
+ /// Represents an internal exception that in theory should never been thrown, it is only thrown in circumstances that should never happen.
///
+ ///
[Serializable]
public class PanicException : Exception
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
public PanicException()
- {
- }
+ { }
- public PanicException(string message) : base(message)
- {
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public PanicException(string message)
+ : base(message)
+ { }
- public PanicException(string message, Exception innerException) : base(message, innerException)
- {
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public PanicException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
- protected PanicException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected PanicException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
}
}
diff --git a/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs b/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs
index 7774bf53de..e354bc4c3d 100644
--- a/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs
+++ b/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs
@@ -1,27 +1,52 @@
using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Exceptions
{
///
/// The exception that is thrown when a requested method or operation is not, and will not be, implemented.
///
- /// The is to be used when some code is not implemented,
+ ///
+ /// The is to be used when some code is not implemented,
/// but should eventually be implemented (i.e. work in progress) and is reported by tools such as ReSharper.
/// This exception is to be used when some code is not implemented, and is not meant to be, for whatever
- /// reason.
+ /// reason.
+ ///
+ ///
+ [Serializable]
+ [Obsolete("If a method or operation is not, and will not be, implemented, it is invalid or not supported, so we should throw either an InvalidOperationException or NotSupportedException instead.")]
public class WontImplementException : NotImplementedException
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public WontImplementException()
{ }
///
- /// Initializes a new instance of the class with a specified reason message.
+ /// Initializes a new instance of the class with a specified reason message.
///
+ /// The error message that explains the reason for the exception.
public WontImplementException(string message)
: base(message)
{ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception. If the parameter is not , the current exception is raised in a block that handles the inner exception.
+ public WontImplementException(string message, Exception inner)
+ : base(message, inner)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected WontImplementException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
}
}
diff --git a/src/Umbraco.Abstractions/IO/FileSecurityException.cs b/src/Umbraco.Abstractions/IO/FileSecurityException.cs
index 7b4f7d2625..8ce9ab34a5 100644
--- a/src/Umbraco.Abstractions/IO/FileSecurityException.cs
+++ b/src/Umbraco.Abstractions/IO/FileSecurityException.cs
@@ -1,20 +1,46 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Runtime.Serialization;
namespace Umbraco.Core.IO
{
+ ///
+ /// The exception that is thrown when the caller does not have the required permission to access a file.
+ ///
+ ///
+ [Obsolete("Throw an UnauthorizedAccessException instead.")]
+ [Serializable]
public class FileSecurityException : Exception
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
public FileSecurityException()
- {
+ { }
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public FileSecurityException(string message)
+ : base(message)
+ { }
- public FileSecurityException(string message) : base(message)
- {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public FileSecurityException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected FileSecurityException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
}
}
diff --git a/src/Umbraco.Abstractions/IO/MediaFileSystem.cs b/src/Umbraco.Abstractions/IO/MediaFileSystem.cs
index b77b6293fd..02564820c5 100644
--- a/src/Umbraco.Abstractions/IO/MediaFileSystem.cs
+++ b/src/Umbraco.Abstractions/IO/MediaFileSystem.cs
@@ -3,9 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -91,7 +89,8 @@ namespace Umbraco.Core.IO
{
if (content == null) throw new ArgumentNullException(nameof(content));
if (propertyType == null) throw new ArgumentNullException(nameof(propertyType));
- if (string.IsNullOrWhiteSpace(filename)) throw new ArgumentNullOrEmptyException(nameof(filename));
+ if (filename == null) throw new ArgumentNullException(nameof(filename));
+ if (string.IsNullOrWhiteSpace(filename)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(filename));
if (filestream == null) throw new ArgumentNullException(nameof(filestream));
// clear the old file, if any
@@ -110,7 +109,8 @@ namespace Umbraco.Core.IO
{
if (content == null) throw new ArgumentNullException(nameof(content));
if (propertyType == null) throw new ArgumentNullException(nameof(propertyType));
- if (string.IsNullOrWhiteSpace(sourcepath)) throw new ArgumentNullOrEmptyException(nameof(sourcepath));
+ if (sourcepath == null) throw new ArgumentNullException(nameof(sourcepath));
+ if (string.IsNullOrWhiteSpace(sourcepath)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(sourcepath));
// ensure we have a file to copy
if (FileExists(sourcepath) == false) return null;
diff --git a/src/Umbraco.Abstractions/IO/PhysicalFileSystem.cs b/src/Umbraco.Abstractions/IO/PhysicalFileSystem.cs
index 01b58ec3cd..24284fec98 100644
--- a/src/Umbraco.Abstractions/IO/PhysicalFileSystem.cs
+++ b/src/Umbraco.Abstractions/IO/PhysicalFileSystem.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.Exceptions;
+using Umbraco.Core.Composing;
using System.Threading;
using Umbraco.Core.Logging;
@@ -47,9 +48,11 @@ namespace Umbraco.Core.IO
_ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
- if (string.IsNullOrEmpty(rootPath)) throw new ArgumentNullOrEmptyException(nameof(rootPath));
- if (string.IsNullOrEmpty(rootUrl)) throw new ArgumentNullOrEmptyException(nameof(rootUrl));
- if (rootPath.StartsWith("~/")) throw new ArgumentException("The rootPath argument cannot be a virtual path and cannot start with '~/'");
+ if (rootPath == null) throw new ArgumentNullException(nameof(rootPath));
+ if (string.IsNullOrEmpty(rootPath)) throw new ArgumentException("Value can't be empty.", nameof(rootPath));
+ if (rootUrl == null) throw new ArgumentNullException(nameof(rootUrl));
+ if (string.IsNullOrEmpty(rootUrl)) throw new ArgumentException("Value can't be empty.", nameof(rootUrl));
+ if (rootPath.StartsWith("~/")) throw new ArgumentException("Value can't be a virtual path and start with '~/'.", nameof(rootPath));
// rootPath should be... rooted, as in, it's a root path!
@@ -323,7 +326,7 @@ namespace Umbraco.Core.IO
// nothing prevents us to reach the file, security-wise, yet it is outside
// this filesystem's root - throw
- throw new FileSecurityException("File '" + opath + "' is outside this filesystem's root.");
+ throw new UnauthorizedAccessException("File '" + opath + "' is outside this filesystem's root.");
}
///
diff --git a/src/Umbraco.Abstractions/Migrations/DataLossException.cs b/src/Umbraco.Abstractions/Migrations/DataLossException.cs
deleted file mode 100644
index 6ff332f626..0000000000
--- a/src/Umbraco.Abstractions/Migrations/DataLossException.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-
-namespace Umbraco.Core.Migrations
-{
- ///
- /// Used if a migration has executed but the whole process has failed and cannot be rolled back
- ///
- internal class DataLossException : Exception
- {
- public DataLossException(string msg)
- : base(msg)
- {
-
- }
-
- public DataLossException(string msg, Exception inner)
- : base(msg, inner)
- {
-
- }
- }
-}
diff --git a/src/Umbraco.Abstractions/Migrations/IncompleteMigrationExpressionException.cs b/src/Umbraco.Abstractions/Migrations/IncompleteMigrationExpressionException.cs
index 91d1838d6f..3c81e2f0e2 100644
--- a/src/Umbraco.Abstractions/Migrations/IncompleteMigrationExpressionException.cs
+++ b/src/Umbraco.Abstractions/Migrations/IncompleteMigrationExpressionException.cs
@@ -1,28 +1,49 @@
using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Migrations
{
///
- /// Represents errors that occurs when a migration exception is not executed.
+ /// The exception that is thrown when a migration expression is not executed.
///
///
- /// Migration expression such as Alter.Table(...).Do() *must* end with Do() else they are
- /// not executed. When a non-executed expression is detected, an IncompleteMigrationExpressionException
- /// is thrown.
+ /// Migration expressions such as Alter.Table(...).Do() must end with Do(), else they are not executed.
+ /// When a non-executed expression is detected, an IncompleteMigrationExpressionException is thrown.
///
+ ///
+ [Serializable]
public class IncompleteMigrationExpressionException : Exception
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public IncompleteMigrationExpressionException()
{ }
///
- /// Initializes a new instance of the class with a message.
+ /// Initializes a new instance of the class with a message.
///
+ /// The message that describes the error.
public IncompleteMigrationExpressionException(string message)
: base(message)
{ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public IncompleteMigrationExpressionException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected IncompleteMigrationExpressionException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
}
}
diff --git a/src/Umbraco.Abstractions/Models/ContentBase.cs b/src/Umbraco.Abstractions/Models/ContentBase.cs
index 59693efe53..2b522b2931 100644
--- a/src/Umbraco.Abstractions/Models/ContentBase.cs
+++ b/src/Umbraco.Abstractions/Models/ContentBase.cs
@@ -4,8 +4,6 @@ using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
-using Umbraco.Core.Composing;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
@@ -229,8 +227,8 @@ namespace Umbraco.Core.Models
private void ClearCultureInfo(string culture)
{
- if (culture.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(culture));
+ if (culture == null) throw new ArgumentNullException(nameof(culture));
+ if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(culture));
if (_cultureInfos == null) return;
_cultureInfos.Remove(culture);
diff --git a/src/Umbraco.Abstractions/Models/ContentCultureInfos.cs b/src/Umbraco.Abstractions/Models/ContentCultureInfos.cs
index c8c4bea56a..2f9c08b985 100644
--- a/src/Umbraco.Abstractions/Models/ContentCultureInfos.cs
+++ b/src/Umbraco.Abstractions/Models/ContentCultureInfos.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
@@ -18,7 +17,9 @@ namespace Umbraco.Core.Models
///
public ContentCultureInfos(string culture)
{
- if (culture.IsNullOrWhiteSpace()) throw new ArgumentNullOrEmptyException(nameof(culture));
+ if (culture == null) throw new ArgumentNullException(nameof(culture));
+ if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(culture));
+
Culture = culture;
}
diff --git a/src/Umbraco.Abstractions/Models/ContentCultureInfosCollection.cs b/src/Umbraco.Abstractions/Models/ContentCultureInfosCollection.cs
index d3ce5ab044..07ee661497 100644
--- a/src/Umbraco.Abstractions/Models/ContentCultureInfosCollection.cs
+++ b/src/Umbraco.Abstractions/Models/ContentCultureInfosCollection.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Specialized;
using Umbraco.Core.Collections;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Models
{
@@ -22,7 +21,9 @@ namespace Umbraco.Core.Models
///
public void AddOrUpdate(string culture, string name, DateTime date)
{
- if (culture.IsNullOrWhiteSpace()) throw new ArgumentNullOrEmptyException(nameof(culture));
+ if (culture == null) throw new ArgumentNullException(nameof(culture));
+ if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(culture));
+
culture = culture.ToLowerInvariant();
if (TryGetValue(culture, out var item))
diff --git a/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs b/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs
index 8bc41e1190..1a1914496d 100644
--- a/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs
+++ b/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs
@@ -1,6 +1,5 @@
using System;
using System.Linq;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Models
{
@@ -8,11 +7,11 @@ namespace Umbraco.Core.Models
{
public static void SetCultureInfo(this IContentBase content, string culture, string name, DateTime date)
{
- if (name.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(name));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
- if (culture.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(culture));
+ if (culture == null) throw new ArgumentNullException(nameof(culture));
+ if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(culture));
content.CultureInfos.AddOrUpdate(culture, name, date);
}
diff --git a/src/Umbraco.Abstractions/Models/Entities/EntitySlim.cs b/src/Umbraco.Abstractions/Models/Entities/EntitySlim.cs
index b6983773b1..489601cf66 100644
--- a/src/Umbraco.Abstractions/Models/Entities/EntitySlim.cs
+++ b/src/Umbraco.Abstractions/Models/Entities/EntitySlim.cs
@@ -11,7 +11,7 @@ namespace Umbraco.Core.Models.Entities
/// Implementation of for internal use.
///
///
- /// Although it implements , this class does not
+ /// Although it implements , this class does not
/// implement and everything this interface defines, throws.
/// Although it implements , this class does not
/// implement and deep-cloning throws.
@@ -67,7 +67,7 @@ namespace Umbraco.Core.Models.Entities
public int ParentId { get; set; }
///
- public void SetParent(ITreeEntity parent) => throw new WontImplementException();
+ public void SetParent(ITreeEntity parent) => throw new InvalidOperationException("This property won't be implemented.");
///
[DataMember]
@@ -117,7 +117,7 @@ namespace Umbraco.Core.Models.Entities
///
public object DeepClone()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
#endregion
@@ -127,5 +127,58 @@ namespace Umbraco.Core.Models.Entities
Id = default;
Key = Guid.Empty;
}
+
+ #region IRememberBeingDirty
+
+ // IEntitySlim does *not* track changes, but since it indirectly implements IUmbracoEntity,
+ // and therefore IRememberBeingDirty, we have to have those methods - which all throw.
+
+ public bool IsDirty()
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public bool IsPropertyDirty(string propName)
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public IEnumerable GetDirtyProperties()
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public void ResetDirtyProperties()
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public bool WasDirty()
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public bool WasPropertyDirty(string propertyName)
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public void ResetWereDirtyProperties()
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public void ResetDirtyProperties(bool rememberDirty)
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ public IEnumerable GetWereDirtyProperties()
+ {
+ throw new InvalidOperationException("This method won't be implemented.");
+ }
+
+ #endregion
+
}
}
diff --git a/src/Umbraco.Abstractions/Models/IPropertyType.cs b/src/Umbraco.Abstractions/Models/IPropertyType.cs
index 6ed5dbd1cb..288a3f2243 100644
--- a/src/Umbraco.Abstractions/Models/IPropertyType.cs
+++ b/src/Umbraco.Abstractions/Models/IPropertyType.cs
@@ -75,5 +75,14 @@ namespace Umbraco.Core.Models
/// A value indicating whether wildcards are valid.
bool SupportsVariation(string culture, string segment, bool wildcards = false);
+ ///
+ /// Gets or sets the custom validation message used when a value for this PropertyType is required
+ ///
+ string MandatoryMessage { get; set; }
+
+ ///
+ /// Gets or sets the custom validation message used when a pattern for this PropertyType must be matched
+ ///
+ string ValidationRegExpMessage { get; set; }
}
}
diff --git a/src/Umbraco.Abstractions/Models/PublishedContent/ModelType.cs b/src/Umbraco.Abstractions/Models/PublishedContent/ModelType.cs
index 318ccc916e..dd60eb9beb 100644
--- a/src/Umbraco.Abstractions/Models/PublishedContent/ModelType.cs
+++ b/src/Umbraco.Abstractions/Models/PublishedContent/ModelType.cs
@@ -20,7 +20,9 @@ namespace Umbraco.Core.Models.PublishedContent
{
private ModelType(string contentTypeAlias)
{
- if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(contentTypeAlias));
+ if (contentTypeAlias == null) throw new ArgumentNullException(nameof(contentTypeAlias));
+ if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(contentTypeAlias));
+
ContentTypeAlias = contentTypeAlias;
Name = "{" + ContentTypeAlias + "}";
}
diff --git a/src/Umbraco.Abstractions/Models/PublishedContent/PublishedCultureInfos.cs b/src/Umbraco.Abstractions/Models/PublishedContent/PublishedCultureInfos.cs
index 47c81ab9a1..495faa6bf3 100644
--- a/src/Umbraco.Abstractions/Models/PublishedContent/PublishedCultureInfos.cs
+++ b/src/Umbraco.Abstractions/Models/PublishedContent/PublishedCultureInfos.cs
@@ -1,5 +1,4 @@
using System;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Models.PublishedContent
{
@@ -13,7 +12,8 @@ namespace Umbraco.Core.Models.PublishedContent
///
public PublishedCultureInfo(string culture, string name, string urlSegment, DateTime date)
{
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
Culture = culture ?? throw new ArgumentNullException(nameof(culture));
Name = name;
diff --git a/src/Umbraco.Abstractions/Models/PublishedContent/PublishedModelAttribute.cs b/src/Umbraco.Abstractions/Models/PublishedContent/PublishedModelAttribute.cs
index 16eb614ee7..3f2c63a78f 100644
--- a/src/Umbraco.Abstractions/Models/PublishedContent/PublishedModelAttribute.cs
+++ b/src/Umbraco.Abstractions/Models/PublishedContent/PublishedModelAttribute.cs
@@ -1,5 +1,4 @@
using System;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Models.PublishedContent
{
@@ -19,7 +18,9 @@ namespace Umbraco.Core.Models.PublishedContent
/// The content type alias.
public PublishedModelAttribute(string contentTypeAlias)
{
- if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(contentTypeAlias));
+ if (contentTypeAlias == null) throw new ArgumentNullException(nameof(contentTypeAlias));
+ if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(contentTypeAlias));
+
ContentTypeAlias = contentTypeAlias;
}
diff --git a/src/Umbraco.Abstractions/Models/RelationType.cs b/src/Umbraco.Abstractions/Models/RelationType.cs
index 259b7bc4ef..725628bf90 100644
--- a/src/Umbraco.Abstractions/Models/RelationType.cs
+++ b/src/Umbraco.Abstractions/Models/RelationType.cs
@@ -1,6 +1,5 @@
using System;
using System.Runtime.Serialization;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
@@ -20,7 +19,9 @@ namespace Umbraco.Core.Models
public RelationType(Guid childObjectType, Guid parentObjectType, string alias)
{
- if (string.IsNullOrWhiteSpace(alias)) throw new ArgumentNullOrEmptyException(nameof(alias));
+ if (alias == null) throw new ArgumentNullException(nameof(alias));
+ if (string.IsNullOrWhiteSpace(alias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(alias));
+
_childObjectType = childObjectType;
_parentObjectType = parentObjectType;
_alias = alias;
@@ -30,7 +31,9 @@ namespace Umbraco.Core.Models
public RelationType(Guid childObjectType, Guid parentObjectType, string alias, string name)
: this(childObjectType, parentObjectType, alias)
{
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
Name = name;
}
diff --git a/src/Umbraco.Abstractions/PropertyEditors/ConfigurationFieldAttribute.cs b/src/Umbraco.Abstractions/PropertyEditors/ConfigurationFieldAttribute.cs
index d90aeef2e6..1852c742f0 100644
--- a/src/Umbraco.Abstractions/PropertyEditors/ConfigurationFieldAttribute.cs
+++ b/src/Umbraco.Abstractions/PropertyEditors/ConfigurationFieldAttribute.cs
@@ -1,5 +1,4 @@
using System;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.PropertyEditors
{
@@ -28,13 +27,15 @@ namespace Umbraco.Core.PropertyEditors
/// The view to use to render the field editor.
public ConfigurationFieldAttribute(string key, string name, string view)
{
- if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullOrEmptyException(nameof(key));
+ if (key == null) throw new ArgumentNullException(nameof(key));
+ if (string.IsNullOrWhiteSpace(key)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(key));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+ if (view == null) throw new ArgumentNullException(nameof(view));
+ if (string.IsNullOrWhiteSpace(view)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(view));
+
Key = key;
-
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
Name = name;
-
- if (string.IsNullOrWhiteSpace(view)) throw new ArgumentNullOrEmptyException(nameof(view));
View = view;
}
@@ -47,10 +48,12 @@ namespace Umbraco.Core.PropertyEditors
/// from the name of the property marked with this attribute.
public ConfigurationFieldAttribute(string name, string view)
{
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
- Name = name;
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+ if (view == null) throw new ArgumentNullException(nameof(view));
+ if (string.IsNullOrWhiteSpace(view)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(view));
- if (string.IsNullOrWhiteSpace(view)) throw new ArgumentNullOrEmptyException(nameof(view));
+ Name = name;
View = view;
}
diff --git a/src/Umbraco.Abstractions/PropertyEditors/DataEditorAttribute.cs b/src/Umbraco.Abstractions/PropertyEditors/DataEditorAttribute.cs
index 821f06513e..7b3be7ea5f 100644
--- a/src/Umbraco.Abstractions/PropertyEditors/DataEditorAttribute.cs
+++ b/src/Umbraco.Abstractions/PropertyEditors/DataEditorAttribute.cs
@@ -1,5 +1,4 @@
using System;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.PropertyEditors
{
@@ -53,17 +52,17 @@ namespace Umbraco.Core.PropertyEditors
///
public DataEditorAttribute(string alias, EditorType type, string name, string view)
{
- if ((type & ~(EditorType.PropertyValue | EditorType.MacroParameter)) > 0)
- throw new ArgumentOutOfRangeException(nameof(type), $"Not a valid {typeof(EditorType)} value.");
+ if (alias == null) throw new ArgumentNullException(nameof(alias));
+ if (string.IsNullOrWhiteSpace(alias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(alias));
+ if ((type & ~(EditorType.PropertyValue | EditorType.MacroParameter)) > 0) throw new ArgumentOutOfRangeException(nameof(type), type, $"Not a valid {typeof(EditorType)} value.");
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+ if (view == null) throw new ArgumentNullException(nameof(view));
+ if (string.IsNullOrWhiteSpace(view)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(view));
+
Type = type;
-
- if (string.IsNullOrWhiteSpace(alias)) throw new ArgumentNullOrEmptyException(nameof(alias));
Alias = alias;
-
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
Name = name;
-
- if (string.IsNullOrWhiteSpace(view)) throw new ArgumentNullOrEmptyException(nameof(view));
View = view == NullView ? null : view;
}
@@ -100,8 +99,10 @@ namespace Umbraco.Core.PropertyEditors
get => _valueType;
set
{
- if (string.IsNullOrWhiteSpace(value)) throw new ArgumentNullOrEmptyException(nameof(value));
- if (!ValueTypes.IsValue(value)) throw new ArgumentOutOfRangeException(nameof(value), $"Not a valid {typeof(ValueTypes)} value.");
+ if (value == null) throw new ArgumentNullException(nameof(value));
+ if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(value));
+ if (!ValueTypes.IsValue(value)) throw new ArgumentOutOfRangeException(nameof(value), value, $"Not a valid {typeof(ValueTypes)} value.");
+
_valueType = value;
}
}
diff --git a/src/Umbraco.Abstractions/PropertyEditors/IValueFormatValidator.cs b/src/Umbraco.Abstractions/PropertyEditors/IValueFormatValidator.cs
index 3e4aea4385..9f29d65ffd 100644
--- a/src/Umbraco.Abstractions/PropertyEditors/IValueFormatValidator.cs
+++ b/src/Umbraco.Abstractions/PropertyEditors/IValueFormatValidator.cs
@@ -21,4 +21,4 @@ namespace Umbraco.Core.PropertyEditors
///
IEnumerable ValidateFormat(object value, string valueType, string format);
}
-}
\ No newline at end of file
+}
diff --git a/src/Umbraco.Abstractions/PropertyEditors/IValueRequiredValidator.cs b/src/Umbraco.Abstractions/PropertyEditors/IValueRequiredValidator.cs
index f8e62788c8..1b4074c96f 100644
--- a/src/Umbraco.Abstractions/PropertyEditors/IValueRequiredValidator.cs
+++ b/src/Umbraco.Abstractions/PropertyEditors/IValueRequiredValidator.cs
@@ -19,4 +19,4 @@ namespace Umbraco.Core.PropertyEditors
///
IEnumerable ValidateRequired(object value, string valueType);
}
-}
\ No newline at end of file
+}
diff --git a/src/Umbraco.Core/Strings/IUrlSegmentProvider.cs b/src/Umbraco.Abstractions/Strings/IUrlSegmentProvider.cs
similarity index 100%
rename from src/Umbraco.Core/Strings/IUrlSegmentProvider.cs
rename to src/Umbraco.Abstractions/Strings/IUrlSegmentProvider.cs
diff --git a/src/Umbraco.Core/Strings/UrlSegmentProviderCollection.cs b/src/Umbraco.Abstractions/Strings/UrlSegmentProviderCollection.cs
similarity index 100%
rename from src/Umbraco.Core/Strings/UrlSegmentProviderCollection.cs
rename to src/Umbraco.Abstractions/Strings/UrlSegmentProviderCollection.cs
diff --git a/src/Umbraco.Core/Strings/UrlSegmentProviderCollectionBuilder.cs b/src/Umbraco.Abstractions/Strings/UrlSegmentProviderCollectionBuilder.cs
similarity index 100%
rename from src/Umbraco.Core/Strings/UrlSegmentProviderCollectionBuilder.cs
rename to src/Umbraco.Abstractions/Strings/UrlSegmentProviderCollectionBuilder.cs
diff --git a/src/Umbraco.Abstractions/Xml/UmbracoXPathPathSyntaxParser.cs b/src/Umbraco.Abstractions/Xml/UmbracoXPathPathSyntaxParser.cs
index 0c8136421d..08178b8fcd 100644
--- a/src/Umbraco.Abstractions/Xml/UmbracoXPathPathSyntaxParser.cs
+++ b/src/Umbraco.Abstractions/Xml/UmbracoXPathPathSyntaxParser.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Xml
{
@@ -35,7 +34,8 @@ namespace Umbraco.Core.Xml
// allowed 'inline', not just at the beginning... whether or not we want to support that is up
// for discussion.
- if (string.IsNullOrWhiteSpace(xpathExpression)) throw new ArgumentNullOrEmptyException(nameof(xpathExpression));
+ if (xpathExpression == null) throw new ArgumentNullException(nameof(xpathExpression));
+ if (string.IsNullOrWhiteSpace(xpathExpression)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(xpathExpression));
if (getPath == null) throw new ArgumentNullException(nameof(getPath));
if (publishedContentExists == null) throw new ArgumentNullException(nameof(publishedContentExists));
diff --git a/src/Umbraco.Abstractions/Xml/XmlHelper.cs b/src/Umbraco.Abstractions/Xml/XmlHelper.cs
index 0a435b23f7..099b73ef36 100644
--- a/src/Umbraco.Abstractions/Xml/XmlHelper.cs
+++ b/src/Umbraco.Abstractions/Xml/XmlHelper.cs
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.XPath;
-using Umbraco.Core.Exceptions;
+using Umbraco.Core.IO;
namespace Umbraco.Core.Xml
{
@@ -14,6 +14,35 @@ namespace Umbraco.Core.Xml
///
public class XmlHelper
{
+ ///
+ /// Creates or sets an attribute on the XmlNode if an Attributes collection is available
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SetAttribute(XmlDocument xml, XmlNode n, string name, string value)
+ {
+ if (xml == null) throw new ArgumentNullException(nameof(xml));
+ if (n == null) throw new ArgumentNullException(nameof(n));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ if (n.Attributes == null)
+ {
+ return;
+ }
+ if (n.Attributes[name] == null)
+ {
+ var a = xml.CreateAttribute(name);
+ a.Value = value;
+ n.Attributes.Append(a);
+ }
+ else
+ {
+ n.Attributes[name].Value = value;
+ }
+ }
///
/// Gets a value indicating whether a specified string contains only xml whitespace characters.
@@ -173,6 +202,145 @@ namespace Umbraco.Core.Xml
}
+ ///
+ /// Opens a file as a XmlDocument.
+ ///
+ /// The relative file path. ie. /config/umbraco.config
+ ///
+ /// Returns a XmlDocument class
+ public static XmlDocument OpenAsXmlDocument(string filePath, IIOHelper ioHelper)
+ {
+ using (var reader = new XmlTextReader(ioHelper.MapPath(filePath)) {WhitespaceHandling = WhitespaceHandling.All})
+ {
+ var xmlDoc = new XmlDocument();
+ //Load the file into the XmlDocument
+ xmlDoc.Load(reader);
+
+ return xmlDoc;
+ }
+ }
+
+ ///
+ /// creates a XmlAttribute with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The name of the attribute.
+ /// The value of the attribute.
+ /// a XmlAttribute
+ public static XmlAttribute AddAttribute(XmlDocument xd, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException(nameof(xd));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ var temp = xd.CreateAttribute(name);
+ temp.Value = value;
+ return temp;
+ }
+
+ ///
+ /// Creates a text XmlNode with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The node name.
+ /// The node value.
+ /// a XmlNode
+ public static XmlNode AddTextNode(XmlDocument xd, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException(nameof(xd));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ var temp = xd.CreateNode(XmlNodeType.Element, name, "");
+ temp.AppendChild(xd.CreateTextNode(value));
+ return temp;
+ }
+
+ ///
+ /// Sets or Creates a text XmlNode with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The node to set or create the child text node on
+ /// The node name.
+ /// The node value.
+ /// a XmlNode
+ public static XmlNode SetTextNode(XmlDocument xd, XmlNode parent, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException(nameof(xd));
+ if (parent == null) throw new ArgumentNullException(nameof(parent));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ var child = parent.SelectSingleNode(name);
+ if (child != null)
+ {
+ child.InnerText = value;
+ return child;
+ }
+ return AddTextNode(xd, name, value);
+ }
+
+ ///
+ /// Sets or creates an Xml node from its inner Xml.
+ ///
+ /// The xmldocument.
+ /// The node to set or create the child text node on
+ /// The node name.
+ /// The node inner Xml.
+ /// a XmlNode
+ public static XmlNode SetInnerXmlNode(XmlDocument xd, XmlNode parent, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException(nameof(xd));
+ if (parent == null) throw new ArgumentNullException(nameof(parent));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ var child = parent.SelectSingleNode(name) ?? xd.CreateNode(XmlNodeType.Element, name, "");
+ child.InnerXml = value;
+ return child;
+ }
+
+ ///
+ /// Creates a cdata XmlNode with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The node name.
+ /// The node value.
+ /// A XmlNode
+ public static XmlNode AddCDataNode(XmlDocument xd, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException(nameof(xd));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ var temp = xd.CreateNode(XmlNodeType.Element, name, "");
+ temp.AppendChild(xd.CreateCDataSection(value));
+ return temp;
+ }
+
+ ///
+ /// Sets or Creates a cdata XmlNode with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The node to set or create the child text node on
+ /// The node name.
+ /// The node value.
+ /// a XmlNode
+ public static XmlNode SetCDataNode(XmlDocument xd, XmlNode parent, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException(nameof(xd));
+ if (parent == null) throw new ArgumentNullException(nameof(parent));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
+ var child = parent.SelectSingleNode(name);
+ if (child != null)
+ {
+ child.InnerXml = ""; ;
+ return child;
+ }
+ return AddCDataNode(xd, name, value);
+ }
///
/// Gets the value of a XmlNode
diff --git a/src/Umbraco.Core/Composing/LightInject/LightInjectException.cs b/src/Umbraco.Core/Composing/LightInject/LightInjectException.cs
index fa0aed21ca..e1344468f9 100644
--- a/src/Umbraco.Core/Composing/LightInject/LightInjectException.cs
+++ b/src/Umbraco.Core/Composing/LightInject/LightInjectException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Core.Composing.LightInject
@@ -6,20 +7,51 @@ namespace Umbraco.Core.Composing.LightInject
///
/// Represents errors that occur due to LightInject.
///
+ ///
+ [Serializable]
public class LightInjectException : Exception
{
- public LightInjectException(string message)
- : base(message)
- { }
-
- public LightInjectException(string message, Exception innerException)
- : base(message, innerException)
- { }
-
private const string LightInjectUnableToResolveType = "Unable to resolve type:";
private const string LightInjectUnresolvedDependency = "Unresolved dependency ";
private const string LightInjectRequestedDependency = "[Requested dependency:";
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public LightInjectException()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public LightInjectException(string message)
+ : base(message)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public LightInjectException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected LightInjectException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
+
+ ///
+ /// Tries to throw the exception with additional details.
+ ///
+ /// The exception.
+ ///
public static void TryThrow(Exception e)
{
var ex = e as InvalidOperationException;
@@ -32,6 +64,12 @@ namespace Umbraco.Core.Composing.LightInject
throw new LightInjectException(sb.ToString(), e);
}
+ ///
+ /// Tries to throw the exception with additional details.
+ ///
+ /// The exception.
+ /// The implementing type.
+ ///
public static void TryThrow(Exception e, Type implementingType)
{
var ex = e as InvalidOperationException;
@@ -45,6 +83,11 @@ namespace Umbraco.Core.Composing.LightInject
throw new LightInjectException(sb.ToString(), e);
}
+ ///
+ /// Writes the details.
+ ///
+ /// The exception.
+ /// The to write the details to.
private static void WriteDetails(InvalidOperationException ex, StringBuilder sb)
{
ex = ex.InnerException as InvalidOperationException;
diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs
index e493acd507..ff8237038b 100644
--- a/src/Umbraco.Core/Manifest/ManifestParser.cs
+++ b/src/Umbraco.Core/Manifest/ManifestParser.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Umbraco.Core.Cache;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
@@ -53,12 +52,13 @@ namespace Umbraco.Core.Manifest
_localizationService = localizationService;
_validators = validators ?? throw new ArgumentNullException(nameof(validators));
_filters = filters ?? throw new ArgumentNullException(nameof(filters));
+ if (path == null) throw new ArgumentNullException(nameof(path));
+ if (string.IsNullOrWhiteSpace(path)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(path));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_ioHelper = ioHelper;
- if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path));
Path = path;
- _logger = logger ?? throw new ArgumentNullException(nameof(logger));
+
}
@@ -170,8 +170,8 @@ namespace Umbraco.Core.Manifest
///
public PackageManifest ParseManifest(string text)
{
- if (string.IsNullOrWhiteSpace(text))
- throw new ArgumentNullOrEmptyException(nameof(text));
+ if (text == null) throw new ArgumentNullException(nameof(text));
+ if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
var manifest = JsonConvert.DeserializeObject(text,
new DataEditorConverter(_logger, _ioHelper, _dataTypeService, _localizationService),
diff --git a/src/Umbraco.Core/Migrations/Expressions/Delete/DeleteBuilder.cs b/src/Umbraco.Core/Migrations/Expressions/Delete/DeleteBuilder.cs
index 9a4f437f62..65c15456a5 100644
--- a/src/Umbraco.Core/Migrations/Expressions/Delete/DeleteBuilder.cs
+++ b/src/Umbraco.Core/Migrations/Expressions/Delete/DeleteBuilder.cs
@@ -1,4 +1,4 @@
-using Umbraco.Core.Exceptions;
+using System;
using Umbraco.Core.Migrations.Expressions.Common;
using Umbraco.Core.Migrations.Expressions.Delete.Column;
using Umbraco.Core.Migrations.Expressions.Delete.Constraint;
@@ -39,8 +39,9 @@ namespace Umbraco.Core.Migrations.Expressions.Delete
///
public IExecutableBuilder KeysAndIndexes(string tableName, bool local = true, bool foreign = true)
{
- if (tableName.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(tableName));
+ if (tableName == null) throw new ArgumentNullException(nameof(tableName));
+ if (string.IsNullOrWhiteSpace(tableName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(tableName));
+
return new DeleteKeysAndIndexesBuilder(_context) { TableName = tableName, DeleteLocal = local, DeleteForeign = foreign };
}
diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs
index 533c6cbbe7..550b1a67dd 100644
--- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs
+++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Xml.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Migrations.Upgrade;
@@ -291,8 +290,10 @@ namespace Umbraco.Core.Migrations.Install
/// A logger.
private static void SaveConnectionString(string connectionString, string providerName, IIOHelper ioHelper, ILogger logger)
{
- if (string.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullOrEmptyException(nameof(connectionString));
- if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentNullOrEmptyException(nameof(providerName));
+ if (connectionString == null) throw new ArgumentNullException(nameof(connectionString));
+ if (string.IsNullOrWhiteSpace(connectionString)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(connectionString));
+ if (providerName == null) throw new ArgumentNullException(nameof(providerName));
+ if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(providerName));
var fileSource = "web.config";
var fileName = ioHelper.MapPath(ioHelper.Root +"/" + fileSource);
diff --git a/src/Umbraco.Core/Migrations/MigrationPlan.cs b/src/Umbraco.Core/Migrations/MigrationPlan.cs
index 37d1a03a5a..89c3c809e8 100644
--- a/src/Umbraco.Core/Migrations/MigrationPlan.cs
+++ b/src/Umbraco.Core/Migrations/MigrationPlan.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
using Type = System.Type;
@@ -25,7 +24,9 @@ namespace Umbraco.Core.Migrations
/// The name of the plan.
public MigrationPlan(string name)
{
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+
Name = name;
}
@@ -43,7 +44,8 @@ namespace Umbraco.Core.Migrations
private MigrationPlan Add(string sourceState, string targetState, Type migration)
{
if (sourceState == null) throw new ArgumentNullException(nameof(sourceState));
- if (string.IsNullOrWhiteSpace(targetState)) throw new ArgumentNullOrEmptyException(nameof(targetState));
+ if (targetState == null) throw new ArgumentNullException(nameof(targetState));
+ if (string.IsNullOrWhiteSpace(targetState)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(targetState));
if (sourceState == targetState) throw new ArgumentException("Source and target state cannot be identical.");
if (migration == null) throw new ArgumentNullException(nameof(migration));
if (!migration.Implements()) throw new ArgumentException($"Type {migration.Name} does not implement IMigration.", nameof(migration));
@@ -135,10 +137,12 @@ namespace Umbraco.Core.Migrations
///
public MigrationPlan ToWithClone(string startState, string endState, string targetState)
{
- if (string.IsNullOrWhiteSpace(startState)) throw new ArgumentNullOrEmptyException(nameof(startState));
- if (string.IsNullOrWhiteSpace(endState)) throw new ArgumentNullOrEmptyException(nameof(endState));
- if (string.IsNullOrWhiteSpace(targetState)) throw new ArgumentNullOrEmptyException(nameof(targetState));
-
+ if (startState == null) throw new ArgumentNullException(nameof(startState));
+ if (string.IsNullOrWhiteSpace(startState)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(startState));
+ if (endState == null) throw new ArgumentNullException(nameof(endState));
+ if (string.IsNullOrWhiteSpace(endState)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(endState));
+ if (targetState == null) throw new ArgumentNullException(nameof(targetState));
+ if (string.IsNullOrWhiteSpace(targetState)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(targetState));
if (startState == endState) throw new ArgumentException("Start and end states cannot be identical.");
startState = startState.Trim();
@@ -317,7 +321,7 @@ namespace Umbraco.Core.Migrations
// throw a raw exception here: this should never happen as the plan has
// been validated - this is just a paranoid safety test
if (!_transitions.TryGetValue(origState, out transition))
- throw new Exception($"Unknown state \"{origState}\".");
+ throw new InvalidOperationException($"Unknown state \"{origState}\".");
}
// prepare and de-duplicate post-migrations, only keeping the 1st occurence
@@ -339,7 +343,7 @@ namespace Umbraco.Core.Migrations
// safety check - again, this should never happen as the plan has been validated,
// and this is just a paranoid safety test
if (origState != _finalState)
- throw new Exception($"Internal error, reached state {origState} which is not final state {_finalState}");
+ throw new InvalidOperationException($"Internal error, reached state {origState} which is not final state {_finalState}");
return origState;
}
@@ -358,7 +362,7 @@ namespace Umbraco.Core.Migrations
var states = new List { origState };
if (!_transitions.TryGetValue(origState, out var transition))
- throw new Exception($"Unknown state \"{origState}\".");
+ throw new InvalidOperationException($"Unknown state \"{origState}\".");
while (transition != null)
{
@@ -373,12 +377,12 @@ namespace Umbraco.Core.Migrations
}
if (!_transitions.TryGetValue(origState, out transition))
- throw new Exception($"Unknown state \"{origState}\".");
+ throw new InvalidOperationException($"Unknown state \"{origState}\".");
}
// safety check
if (origState != (toState ?? _finalState))
- throw new Exception($"Internal error, reached state {origState} which is not state {toState ?? _finalState}");
+ throw new InvalidOperationException($"Internal error, reached state {origState} which is not state {toState ?? _finalState}");
return states;
}
@@ -417,7 +421,7 @@ namespace Umbraco.Core.Migrations
public override string ToString()
{
return MigrationType == typeof(NoopMigration)
- ? $"{(SourceState == "" ? "" : SourceState)} --> {TargetState}"
+ ? $"{(SourceState == string.Empty ? "" : SourceState)} --> {TargetState}"
: $"{SourceState} -- ({MigrationType.FullName}) --> {TargetState}";
}
}
diff --git a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
index c657d0d9e7..ed440eb126 100644
--- a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
+++ b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
@@ -6,6 +6,7 @@ using Umbraco.Core.Migrations.Upgrade.Common;
using Umbraco.Core.Migrations.Upgrade.V_8_0_0;
using Umbraco.Core.Migrations.Upgrade.V_8_0_1;
using Umbraco.Core.Migrations.Upgrade.V_8_1_0;
+using Umbraco.Core.Migrations.Upgrade.V_8_6_0;
namespace Umbraco.Core.Migrations.Upgrade
{
@@ -183,6 +184,9 @@ namespace Umbraco.Core.Migrations.Upgrade
To("{0372A42B-DECF-498D-B4D1-6379E907EB94}");
To("{5B1E0D93-F5A3-449B-84BA-65366B84E2D4}");
+ // to 8.6.0
+ To("{3D67D2C8-5E65-47D0-A9E1-DC2EE0779D6B}");
+
//FINAL
}
}
diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_6_0/AddPropertyTypeValidationMessageColumns.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_6_0/AddPropertyTypeValidationMessageColumns.cs
new file mode 100644
index 0000000000..30eb30109e
--- /dev/null
+++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_6_0/AddPropertyTypeValidationMessageColumns.cs
@@ -0,0 +1,20 @@
+using System.Linq;
+using Umbraco.Core.Persistence.Dtos;
+
+namespace Umbraco.Core.Migrations.Upgrade.V_8_6_0
+{
+ public class AddPropertyTypeValidationMessageColumns : MigrationBase
+ {
+ public AddPropertyTypeValidationMessageColumns(IMigrationContext context)
+ : base(context)
+ { }
+
+ public override void Migrate()
+ {
+ var columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToList();
+
+ AddColumnIfNotExists(columns, "mandatoryMessage");
+ AddColumnIfNotExists(columns, "validationRegExpMessage");
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs b/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
index db557e1905..ffda3de194 100644
--- a/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
+++ b/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Models
{
@@ -103,11 +102,11 @@ namespace Umbraco.Core.Models
public static void SetPublishInfo(this IContent content, string culture, string name, DateTime date)
{
- if (string.IsNullOrWhiteSpace(name))
- throw new ArgumentNullOrEmptyException(nameof(name));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
- if (culture.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(culture));
+ if (culture == null) throw new ArgumentNullException(nameof(culture));
+ if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(culture));
content.PublishCultureInfos.AddOrUpdate(culture, name, date);
}
@@ -240,8 +239,8 @@ namespace Umbraco.Core.Models
///
public static bool ClearPublishInfo(this IContent content, string culture)
{
- if (culture.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(culture));
+ if (culture == null) throw new ArgumentNullException(nameof(culture));
+ if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(culture));
var removed = content.PublishCultureInfos.Remove(culture);
if (removed)
diff --git a/src/Umbraco.Core/Models/Member.cs b/src/Umbraco.Core/Models/Member.cs
index 39724245ca..a01840d0c8 100644
--- a/src/Umbraco.Core/Models/Member.cs
+++ b/src/Umbraco.Core/Models/Member.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Composing;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Models
@@ -42,7 +41,8 @@ namespace Umbraco.Core.Models
public Member(string name, IMemberType contentType)
: base(name, -1, contentType, new PropertyCollection())
{
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
IsApproved = true;
@@ -62,9 +62,12 @@ namespace Umbraco.Core.Models
public Member(string name, string email, string username, IMemberType contentType, bool isApproved = true)
: base(name, -1, contentType, new PropertyCollection())
{
- if (string.IsNullOrWhiteSpace(email)) throw new ArgumentNullOrEmptyException(nameof(email));
- if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
- if (string.IsNullOrWhiteSpace(username)) throw new ArgumentNullOrEmptyException(nameof(username));
+ if (name == null) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(name));
+ if (email == null) throw new ArgumentNullException(nameof(email));
+ if (string.IsNullOrWhiteSpace(email)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(email));
+ if (username == null) throw new ArgumentNullException(nameof(username));
+ if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(username));
_email = email;
_username = username;
diff --git a/src/Umbraco.Core/Models/PropertyType.cs b/src/Umbraco.Core/Models/PropertyType.cs
index 65c0ffeade..d749b7f4bd 100644
--- a/src/Umbraco.Core/Models/PropertyType.cs
+++ b/src/Umbraco.Core/Models/PropertyType.cs
@@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
+using Umbraco.Core.Composing;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Strings;
@@ -25,8 +26,10 @@ namespace Umbraco.Core.Models
private string _propertyEditorAlias;
private ValueStorageType _valueStorageType;
private bool _mandatory;
+ private string _mandatoryMessage;
private int _sortOrder;
private string _validationRegExp;
+ private string _validationRegExpMessage;
private ContentVariation _variations;
///
@@ -168,7 +171,6 @@ namespace Umbraco.Core.Models
set => SetPropertyValueAndDetectChanges(value, ref _propertyGroupId, nameof(PropertyGroupId));
}
-
///
[DataMember]
public bool Mandatory
@@ -178,6 +180,14 @@ namespace Umbraco.Core.Models
}
+ ///
+ [DataMember]
+ public string MandatoryMessage
+ {
+ get => _mandatoryMessage;
+ set => SetPropertyValueAndDetectChanges(value, ref _mandatoryMessage, nameof(MandatoryMessage));
+ }
+
///
[DataMember]
public int SortOrder
@@ -194,6 +204,17 @@ namespace Umbraco.Core.Models
set => SetPropertyValueAndDetectChanges(value, ref _validationRegExp, nameof(ValidationRegExp));
}
+
+ ///
+ /// Gets or sets the custom validation message used when a pattern for this PropertyType must be matched
+ ///
+ [DataMember]
+ public string ValidationRegExpMessage
+ {
+ get => _validationRegExpMessage;
+ set => SetPropertyValueAndDetectChanges(value, ref _validationRegExpMessage, nameof(ValidationRegExpMessage));
+ }
+
///
public ContentVariation Variations
{
diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs
index 4146ef1664..ff50b7acde 100644
--- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs
+++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs
@@ -785,7 +785,14 @@ namespace Umbraco.Core.Packaging
Mandatory = property.Element("Mandatory") != null
? property.Element("Mandatory").Value.ToLowerInvariant().Equals("true")
: false,
+ MandatoryMessage = property.Element("MandatoryMessage") != null
+ ? (string)property.Element("MandatoryMessage")
+ : string.Empty,
+
ValidationRegExp = (string)property.Element("Validation"),
+ ValidationRegExpMessage = property.Element("ValidationRegExpMessage") != null
+ ? (string)property.Element("ValidationRegExpMessage")
+ : string.Empty,
SortOrder = sortOrder,
Variations = property.Element("Variations") != null
? (ContentVariation)Enum.Parse(typeof(ContentVariation), property.Element("Variations").Value)
diff --git a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs
index 8c52aa1e15..3e8d6e7496 100644
--- a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs
+++ b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs
@@ -43,10 +43,20 @@ namespace Umbraco.Core.Persistence.Dtos
[Constraint(Default = "0")]
public bool Mandatory { get; set; }
+ [Column("mandatoryMessage")]
+ [NullSetting(NullSetting = NullSettings.Null)]
+ [Length(500)]
+ public string MandatoryMessage { get; set; }
+
[Column("validationRegExp")]
[NullSetting(NullSetting = NullSettings.Null)]
public string ValidationRegExp { get; set; }
+ [Column("validationRegExpMessage")]
+ [NullSetting(NullSetting = NullSettings.Null)]
+ [Length(500)]
+ public string ValidationRegExpMessage { get; set; }
+
[Column("Description")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(2000)]
diff --git a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeReadOnlyDto.cs b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeReadOnlyDto.cs
index c68dee42b5..4c352a0134 100644
--- a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeReadOnlyDto.cs
+++ b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeReadOnlyDto.cs
@@ -32,9 +32,15 @@ namespace Umbraco.Core.Persistence.Dtos
[Column("mandatory")]
public bool Mandatory { get; set; }
+ [Column("mandatoryMessage")]
+ public string MandatoryMessage { get; set; }
+
[Column("validationRegExp")]
public string ValidationRegExp { get; set; }
+ [Column("validationRegExpMessage")]
+ public string ValidationRegExpMessage { get; set; }
+
[Column("Description")]
public string Description { get; set; }
diff --git a/src/Umbraco.Core/Persistence/EntityNotFoundException.cs b/src/Umbraco.Core/Persistence/EntityNotFoundException.cs
index e0fe778fa6..ea6d5142f0 100644
--- a/src/Umbraco.Core/Persistence/EntityNotFoundException.cs
+++ b/src/Umbraco.Core/Persistence/EntityNotFoundException.cs
@@ -1,38 +1,96 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Persistence
{
-
- // TODO: Would be good to use this exception type anytime we cannot find an entity
-
///
- /// An exception used to indicate that an umbraco entity could not be found
+ /// An exception used to indicate that an Umbraco entity could not be found.
///
+ ///
+ [Obsolete("Instead of throwing an exception, return null or an HTTP 404 status code instead.")]
+ [Serializable]
public class EntityNotFoundException : Exception
{
+ ///
+ /// Gets the identifier.
+ ///
+ ///
+ /// The identifier.
+ ///
+ ///
+ /// This object should be serializable to prevent a to be thrown.
+ ///
public object Id { get; private set; }
- private readonly string _msg;
- public EntityNotFoundException(object id, string msg)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public EntityNotFoundException()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The identifier.
+ /// The message.
+ public EntityNotFoundException(object id, string message)
+ : base(message)
{
Id = id;
- _msg = msg;
}
- public EntityNotFoundException(string msg)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message that describes the error.
+ public EntityNotFoundException(string message)
+ : base(message)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
+ public EntityNotFoundException(string message, Exception innerException)
+ : base(message, innerException)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected EntityNotFoundException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
- _msg = msg;
+ Id = info.GetValue(nameof(Id), typeof(object));
}
- public override string Message
+ ///
+ /// When overridden in a derived class, sets the with information about the exception.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ /// info
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
- get { return _msg; }
+ if (info == null)
+ {
+ throw new ArgumentNullException(nameof(info));
+ }
+
+ info.AddValue(nameof(Id), Id);
+
+ base.GetObjectData(info, context);
}
+ ///
+ /// Returns a that represents this instance.
+ ///
+ ///
+ /// A that represents this instance.
+ ///
public override string ToString()
{
var result = base.ToString();
diff --git a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs
index a3014000b6..ab1de9cb40 100644
--- a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs
+++ b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs
@@ -60,8 +60,10 @@ namespace Umbraco.Core.Persistence.Factories
propertyType.Key = typeDto.UniqueId;
propertyType.Name = typeDto.Name;
propertyType.Mandatory = typeDto.Mandatory;
+ propertyType.MandatoryMessage = typeDto.MandatoryMessage;
propertyType.SortOrder = typeDto.SortOrder;
propertyType.ValidationRegExp = typeDto.ValidationRegExp;
+ propertyType.ValidationRegExpMessage = typeDto.ValidationRegExpMessage;
propertyType.PropertyGroupId = new Lazy(() => tempGroupDto.Id);
propertyType.CreateDate = createDate;
propertyType.UpdateDate = updateDate;
@@ -124,9 +126,11 @@ namespace Umbraco.Core.Persistence.Factories
DataTypeId = propertyType.DataTypeId,
Description = propertyType.Description,
Mandatory = propertyType.Mandatory,
+ MandatoryMessage = propertyType.MandatoryMessage,
Name = propertyType.Name,
SortOrder = propertyType.SortOrder,
ValidationRegExp = propertyType.ValidationRegExp,
+ ValidationRegExpMessage = propertyType.ValidationRegExpMessage,
UniqueId = propertyType.Key,
Variations = (byte)propertyType.Variations
};
diff --git a/src/Umbraco.Core/Persistence/FaultHandling/RetryLimitExceededException.cs b/src/Umbraco.Core/Persistence/FaultHandling/RetryLimitExceededException.cs
index c537281dc9..a1a0db2983 100644
--- a/src/Umbraco.Core/Persistence/FaultHandling/RetryLimitExceededException.cs
+++ b/src/Umbraco.Core/Persistence/FaultHandling/RetryLimitExceededException.cs
@@ -4,59 +4,51 @@ using System.Runtime.Serialization;
namespace Umbraco.Core.Persistence.FaultHandling
{
///
- /// The special type of exception that provides managed exit from a retry loop. The user code can use this
- /// exception to notify the retry policy that no further retry attempts are required.
+ /// The special type of exception that provides managed exit from a retry loop. The user code can use this exception to notify the retry policy that no further retry attempts are required.
///
+ ///
[Serializable]
public sealed class RetryLimitExceededException : Exception
{
///
- /// Initializes a new instance of the class with a default error message.
+ /// Initializes a new instance of the class with a default error message.
///
public RetryLimitExceededException()
- : this("RetryLimitExceeded")
- {
- }
+ : base()
+ { }
///
- /// Initializes a new instance of the class with a specified error message.
+ /// Initializes a new instance of the class with a specified error message.
///
/// The message that describes the error.
public RetryLimitExceededException(string message)
: base(message)
- {
- }
+ { }
///
- /// Initializes a new instance of the class with a reference to the inner exception
- /// that is the cause of this exception.
+ /// Initializes a new instance of the class with a reference to the inner exception that is the cause of this exception.
///
/// The exception that is the cause of the current exception.
public RetryLimitExceededException(Exception innerException)
- : base(innerException != null ? innerException.Message : "RetryLimitExceeded", innerException)
- {
- }
+ : base(null, innerException)
+ { }
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The message that describes the error.
/// The exception that is the cause of the current exception.
public RetryLimitExceededException(string message, Exception innerException)
: base(message, innerException)
- {
- }
+ { }
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// The that holds the serialized object data about the exception being thrown.
- /// The that contains contextual information about the source or destination.
- /// The parameter is null.
- /// The class name is null or is zero (0).
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
private RetryLimitExceededException(SerializationInfo info, StreamingContext context)
: base(info, context)
- {
- }
+ { }
}
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs
index a9cabf1852..37bb20285c 100644
--- a/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs
@@ -24,9 +24,11 @@ namespace Umbraco.Core.Persistence.Mappers
DefineMap(nameof(PropertyType.DataTypeId), nameof(PropertyTypeDto.DataTypeId));
DefineMap(nameof(PropertyType.Description), nameof(PropertyTypeDto.Description));
DefineMap(nameof(PropertyType.Mandatory), nameof(PropertyTypeDto.Mandatory));
+ DefineMap(nameof(PropertyType.MandatoryMessage), nameof(PropertyTypeDto.MandatoryMessage));
DefineMap(nameof(PropertyType.Name), nameof(PropertyTypeDto.Name));
DefineMap(nameof(PropertyType.SortOrder), nameof(PropertyTypeDto.SortOrder));
DefineMap(nameof(PropertyType.ValidationRegExp), nameof(PropertyTypeDto.ValidationRegExp));
+ DefineMap(nameof(PropertyType.ValidationRegExpMessage), nameof(PropertyTypeDto.ValidationRegExpMessage));
DefineMap(nameof(PropertyType.PropertyEditorAlias), nameof(DataTypeDto.EditorAlias));
DefineMap(nameof(PropertyType.ValueStorageType), nameof(DataTypeDto.DbType));
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs
index 5409c54190..b0cdc054fc 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs
@@ -296,10 +296,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
Id = dto.Id,
Key = dto.UniqueId,
Mandatory = dto.Mandatory,
+ MandatoryMessage = dto.MandatoryMessage,
Name = dto.Name,
PropertyGroupId = groupId.HasValue ? new Lazy(() => groupId.Value) : null,
SortOrder = dto.SortOrder,
ValidationRegExp = dto.ValidationRegExp,
+ ValidationRegExpMessage = dto.ValidationRegExpMessage,
Variations = (ContentVariation)dto.Variations
};
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs
index 3588ed3128..1d28f3530d 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs
@@ -924,32 +924,32 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override IEnumerable PerformGetByQuery(IQuery query)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable GetDeleteClauses()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override void PersistNewItem(IContent entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override void PersistUpdatedItem(IContent entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override Sql GetBaseQuery(bool isCount)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override string GetBaseWhereClause()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs
index 09fe949df1..505cbfc816 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using NPoco;
using Umbraco.Core.Cache;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Dtos;
@@ -129,6 +128,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistDeletedItem(EntityContainer entity)
{
+ if (entity == null) throw new ArgumentNullException(nameof(entity));
EnsureContainerType(entity);
var nodeDto = Database.FirstOrDefault(Sql().SelectAll()
@@ -162,9 +162,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(EntityContainer entity)
{
+ if (entity == null) throw new ArgumentNullException(nameof(entity));
EnsureContainerType(entity);
- if (string.IsNullOrWhiteSpace(entity.Name)) throw new ArgumentNullOrEmptyException("entity.Name");
+ if (entity.Name == null) throw new InvalidOperationException("Entity name can't be null.");
+ if (string.IsNullOrWhiteSpace(entity.Name)) throw new InvalidOperationException("Entity name can't be empty or consist only of white-space characters.");
entity.Name = entity.Name.Trim();
// guard against duplicates
@@ -184,7 +186,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
.Where(dto => dto.NodeId == entity.ParentId && dto.NodeObjectType == entity.ContainerObjectType));
if (parentDto == null)
- throw new NullReferenceException("Could not find parent container with id " + entity.ParentId);
+ throw new InvalidOperationException("Could not find parent container with id " + entity.ParentId);
level = parentDto.Level;
path = parentDto.Path;
@@ -223,10 +225,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
//
protected override void PersistUpdatedItem(EntityContainer entity)
{
+ if (entity == null) throw new ArgumentNullException(nameof(entity));
EnsureContainerType(entity);
+ if (entity.Name == null) throw new InvalidOperationException("Entity name can't be null.");
+ if (string.IsNullOrWhiteSpace(entity.Name)) throw new InvalidOperationException("Entity name can't be empty or consist only of white-space characters.");
entity.Name = entity.Name.Trim();
- if (string.IsNullOrWhiteSpace(entity.Name)) throw new ArgumentNullOrEmptyException("entity.Name");
// find container to update
var nodeDto = Database.FirstOrDefault(Sql().SelectAll()
@@ -255,7 +259,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
.Where(dto => dto.NodeId == entity.ParentId && dto.NodeObjectType == entity.ContainerObjectType));
if (parent == null)
- throw new NullReferenceException("Could not find parent container with id " + entity.ParentId);
+ throw new InvalidOperationException("Could not find parent container with id " + entity.ParentId);
nodeDto.Level = Convert.ToInt16(parent.Level + 1);
nodeDto.Path = parent.Path + "," + nodeDto.NodeId;
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs
index 9b9a738301..ca78198fc3 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs
@@ -424,32 +424,32 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override IEnumerable PerformGetByQuery(IQuery query)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable GetDeleteClauses()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override void PersistNewItem(IMedia entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override void PersistUpdatedItem(IMedia entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override Sql GetBaseQuery(bool isCount)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override string GetBaseWhereClause()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/PermissionRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/PermissionRepository.cs
index b4fd86c567..259f0b89c0 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/PermissionRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/PermissionRepository.cs
@@ -252,27 +252,27 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override ContentPermissionSet PerformGet(int id)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable PerformGetAll(params int[] ids)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable PerformGetByQuery(IQuery query)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override Sql GetBaseQuery(bool isCount)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override string GetBaseWhereClause()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable GetDeleteClauses()
@@ -280,11 +280,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
return new List();
}
- protected override Guid NodeObjectTypeId => throw new WontImplementException();
+ protected override Guid NodeObjectTypeId => throw new InvalidOperationException("This property won't be implemented.");
protected override void PersistDeletedItem(ContentPermissionSet entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
#endregion
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/SimpleGetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/SimpleGetRepository.cs
index 43233d0f31..f7e59820c3 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/SimpleGetRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/SimpleGetRepository.cs
@@ -75,19 +75,19 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected sealed override IEnumerable GetDeleteClauses()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
- protected sealed override Guid NodeObjectTypeId => throw new WontImplementException();
+ protected sealed override Guid NodeObjectTypeId => throw new InvalidOperationException("This property won't be implemented.");
protected sealed override void PersistNewItem(TEntity entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected sealed override void PersistUpdatedItem(TEntity entity)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
#endregion
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs
index 0701a0996e..0a66e29147 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs
@@ -286,7 +286,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
return list;
}
- protected override Guid NodeObjectTypeId => throw new WontImplementException();
+ protected override Guid NodeObjectTypeId => throw new InvalidOperationException("This property won't be implemented.");
protected override void PersistNewItem(IUserGroup entity)
{
@@ -370,35 +370,35 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override UserGroupWithUsers PerformGet(int id)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable PerformGetAll(params int[] ids)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable PerformGetByQuery(IQuery query)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override Sql GetBaseQuery(bool isCount)
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override string GetBaseWhereClause()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
protected override IEnumerable GetDeleteClauses()
{
- throw new WontImplementException();
+ throw new InvalidOperationException("This method won't be implemented.");
}
- protected override Guid NodeObjectTypeId => throw new WontImplementException();
+ protected override Guid NodeObjectTypeId => throw new InvalidOperationException("This property won't be implemented.");
#endregion
diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs
index 6a1a3ee3f1..2a1aa7d6dc 100644
--- a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs
+++ b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs
@@ -5,7 +5,6 @@ using NPoco;
using NPoco.FluentMappings;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.FaultHandling;
using Umbraco.Core.Persistence.Mappers;
@@ -62,8 +61,8 @@ namespace Umbraco.Core.Persistence
/// Used by the other ctor and in tests.
public UmbracoDatabaseFactory(string connectionStringName, ILogger logger, Lazy mappers, Configs configs)
{
- if (string.IsNullOrWhiteSpace(connectionStringName))
- throw new ArgumentNullOrEmptyException(nameof(connectionStringName));
+ if (connectionStringName == null) throw new ArgumentNullException(nameof(connectionStringName));
+ if (string.IsNullOrWhiteSpace(connectionStringName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(connectionStringName));
_mappers = mappers ?? throw new ArgumentNullException(nameof(mappers));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
diff --git a/src/Umbraco.Core/PropertyEditors/Validators/RegexValidator.cs b/src/Umbraco.Core/PropertyEditors/Validators/RegexValidator.cs
index 2bd3e0ab40..651596635b 100644
--- a/src/Umbraco.Core/PropertyEditors/Validators/RegexValidator.cs
+++ b/src/Umbraco.Core/PropertyEditors/Validators/RegexValidator.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using Umbraco.Core.Composing;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Services;
namespace Umbraco.Core.PropertyEditors.Validators
@@ -50,8 +49,9 @@ namespace Umbraco.Core.PropertyEditors.Validators
get => _regex;
set
{
- if (string.IsNullOrWhiteSpace(value))
- throw new ArgumentNullOrEmptyException(nameof(value));
+ if (value == null) throw new ArgumentNullException(nameof(value));
+ if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(value));
+
_regex = value;
}
}
@@ -60,7 +60,9 @@ namespace Umbraco.Core.PropertyEditors.Validators
public IEnumerable Validate(object value, string valueType, object dataTypeConfiguration)
{
if (_regex == null)
+ {
throw new InvalidOperationException("The validator has not been configured.");
+ }
return ValidateFormat(value, valueType, _regex);
}
@@ -68,7 +70,8 @@ namespace Umbraco.Core.PropertyEditors.Validators
///
public IEnumerable ValidateFormat(object value, string valueType, string format)
{
- if (string.IsNullOrWhiteSpace(format)) throw new ArgumentNullOrEmptyException(nameof(format));
+ if (format == null) throw new ArgumentNullException(nameof(format));
+ if (string.IsNullOrWhiteSpace(format)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(format));
if (value == null || !new Regex(format).IsMatch(value.ToString()))
{
yield return new ValidationResult(_textService?.Localize("validation", "invalidPattern") ?? ValueIsInvalid, new[] { "value" });
diff --git a/src/Umbraco.Core/PropertyEditors/Validators/RequiredValidator.cs b/src/Umbraco.Core/PropertyEditors/Validators/RequiredValidator.cs
index 30342fbf2d..e47ca56333 100644
--- a/src/Umbraco.Core/PropertyEditors/Validators/RequiredValidator.cs
+++ b/src/Umbraco.Core/PropertyEditors/Validators/RequiredValidator.cs
@@ -45,7 +45,7 @@ namespace Umbraco.Core.PropertyEditors.Validators
{
if (value.ToString().DetectIsEmptyJson())
{
-
+
yield return new ValidationResult(_textService?.Localize("validation", "invalidEmpty") ?? ValueCannotBeEmpty, new[] { "value" });
}
diff --git a/src/Umbraco.Core/ReflectionUtilities.cs b/src/Umbraco.Core/ReflectionUtilities.cs
index 622d81f5f2..a8e6836ca1 100644
--- a/src/Umbraco.Core/ReflectionUtilities.cs
+++ b/src/Umbraco.Core/ReflectionUtilities.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
-using Umbraco.Core.Exceptions;
namespace Umbraco.Core
{
@@ -29,10 +28,14 @@ namespace Umbraco.Core
/// The declaring type.
/// The field type.
/// The name of the field.
- /// A field getter function.
- /// Occurs when is null or empty.
- /// Occurs when the field does not exist.
- /// Occurs when does not match the type of the field.
+ ///
+ /// A field getter function.
+ ///
+ /// fieldName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match field . type.
+ /// Could not find field ..
public static Func EmitFieldGetter(string fieldName)
{
var field = GetField(fieldName);
@@ -45,10 +48,14 @@ namespace Umbraco.Core
/// The declaring type.
/// The field type.
/// The name of the field.
- /// A field setter action.
- /// Occurs when is null or empty.
- /// Occurs when the field does not exist.
- /// Occurs when does not match the type of the field.
+ ///
+ /// A field setter action.
+ ///
+ /// fieldName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match field . type.
+ /// Could not find field ..
public static Action EmitFieldSetter(string fieldName)
{
var field = GetField(fieldName);
@@ -61,19 +68,36 @@ namespace Umbraco.Core
/// The declaring type.
/// The field type.
/// The name of the field.
- /// A field getter and setter functions.
- /// Occurs when is null or empty.
- /// Occurs when the field does not exist.
- /// Occurs when does not match the type of the field.
+ ///
+ /// A field getter and setter functions.
+ ///
+ /// fieldName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match field . type.
+ /// Could not find field ..
public static (Func, Action) EmitFieldGetterAndSetter(string fieldName)
{
var field = GetField(fieldName);
return (EmitFieldGetter(field), EmitFieldSetter(field));
}
+ ///
+ /// Gets the field.
+ ///
+ /// The type of the declaring.
+ /// The type of the value.
+ /// Name of the field.
+ ///
+ /// fieldName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match field . type.
+ /// Could not find field ..
private static FieldInfo GetField(string fieldName)
{
- if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentNullOrEmptyException(nameof(fieldName));
+ if (fieldName == null) throw new ArgumentNullException(nameof(fieldName));
+ if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(fieldName));
// get the field
var field = typeof(TDeclaring).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
@@ -120,13 +144,18 @@ namespace Umbraco.Core
/// The property type.
/// The name of the property.
/// A value indicating whether the property and its getter must exist.
- /// A property getter function. If is false, returns null when the property or its getter does not exist.
- /// Occurs when is null or empty.
- /// Occurs when the property or its getter does not exist.
- /// Occurs when does not match the type of the property.
+ ///
+ /// A property getter function. If is false, returns null when the property or its getter does not exist.
+ ///
+ /// propertyName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match property . type.
+ /// Could not find property getter for ..
public static Func EmitPropertyGetter(string propertyName, bool mustExist = true)
{
- if (string.IsNullOrWhiteSpace(propertyName)) throw new ArgumentNullOrEmptyException(nameof(propertyName));
+ if (propertyName == null) throw new ArgumentNullException(nameof(propertyName));
+ if (string.IsNullOrWhiteSpace(propertyName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyName));
var property = typeof(TDeclaring).GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
@@ -146,13 +175,18 @@ namespace Umbraco.Core
/// The property type.
/// The name of the property.
/// A value indicating whether the property and its setter must exist.
- /// A property setter function. If is false, returns null when the property or its setter does not exist.
- /// Occurs when is null or empty.
- /// Occurs when the property or its setter does not exist.
- /// Occurs when does not match the type of the property.
+ ///
+ /// A property setter function. If is false, returns null when the property or its setter does not exist.
+ ///
+ /// propertyName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match property . type.
+ /// Could not find property setter for ..
public static Action EmitPropertySetter(string propertyName, bool mustExist = true)
{
- if (string.IsNullOrWhiteSpace(propertyName)) throw new ArgumentNullOrEmptyException(nameof(propertyName));
+ if (propertyName == null) throw new ArgumentNullException(nameof(propertyName));
+ if (string.IsNullOrWhiteSpace(propertyName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyName));
var property = typeof(TDeclaring).GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
@@ -172,13 +206,18 @@ namespace Umbraco.Core
/// The property type.
/// The name of the property.
/// A value indicating whether the property and its getter and setter must exist.
- /// A property getter and setter functions. If is false, returns null when the property or its getter or setter does not exist.
- /// Occurs when is null or empty.
- /// Occurs when the property or its getter or setter does not exist.
- /// Occurs when does not match the type of the property.
+ ///
+ /// A property getter and setter functions. If is false, returns null when the property or its getter or setter does not exist.
+ ///
+ /// propertyName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Value type does not match property . type.
+ /// Could not find property getter and setter for ..
public static (Func, Action) EmitPropertyGetterAndSetter(string propertyName, bool mustExist = true)
{
- if (string.IsNullOrWhiteSpace(propertyName)) throw new ArgumentNullOrEmptyException(nameof(propertyName));
+ if (propertyName == null) throw new ArgumentNullException(nameof(propertyName));
+ if (string.IsNullOrWhiteSpace(propertyName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyName));
var property = typeof(TDeclaring).GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
@@ -402,13 +441,17 @@ namespace Umbraco.Core
/// A lambda representing the method.
/// The name of the method.
/// A value indicating whether the constructor must exist.
- /// The method. If is false, returns null when the method does not exist.
+ ///
+ /// The method. If is false, returns null when the method does not exist.
+ ///
+ /// methodName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Occurs when does not match the method signature..
+ /// Occurs when no proper method with name could be found.
///
- /// The method arguments are determined by generic arguments.
+ /// The method arguments are determined by generic arguments.
///
- /// Occurs when is null or empty.
- /// Occurs when no proper method with name could be found.
- /// Occurs when Occurs when does not match the method signature.
public static TLambda EmitMethod(string methodName, bool mustExist = true)
{
return EmitMethod(typeof(TDeclaring), methodName, mustExist);
@@ -421,16 +464,21 @@ namespace Umbraco.Core
/// The declaring type.
/// The name of the method.
/// A value indicating whether the constructor must exist.
- /// The method. If is false, returns null when the method does not exist.
+ ///
+ /// The method. If is false, returns null when the method does not exist.
+ ///
+ /// methodName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Occurs when does not match the method signature..
+ /// Occurs when no proper method with name could be found.
///
- /// The method arguments are determined by generic arguments.
+ /// The method arguments are determined by generic arguments.
///
- /// Occurs when is null or empty.
- /// Occurs when no proper method with name could be found.
- /// Occurs when Occurs when does not match the method signature.
public static TLambda EmitMethod(Type declaring, string methodName, bool mustExist = true)
{
- if (string.IsNullOrWhiteSpace(methodName)) throw new ArgumentNullOrEmptyException(nameof(methodName));
+ if (methodName == null) throw new ArgumentNullException(nameof(methodName));
+ if (string.IsNullOrWhiteSpace(methodName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(methodName));
var (lambdaDeclaring, lambdaParameters, lambdaReturned) = AnalyzeLambda(true, out var isFunction);
@@ -510,17 +558,21 @@ namespace Umbraco.Core
/// A lambda representing the method.
/// The name of the method.
/// A value indicating whether the constructor must exist.
- /// The method. If is false, returns null when the method does not exist.
+ ///
+ /// The method. If is false, returns null when the method does not exist.
+ ///
+ /// methodName
+ /// Value can't be empty or consist only of white-space characters. -
+ /// or
+ /// Occurs when does not match the method signature..
+ /// Occurs when no proper method with name could be found.
///
- /// The method arguments are determined by generic arguments.
+ /// The method arguments are determined by generic arguments.
///
- /// Occurs when is null or empty.
- /// Occurs when no proper method with name could be found.
- /// Occurs when Occurs when does not match the method signature.
public static TLambda EmitMethod(string methodName, bool mustExist = true)
{
- if (string.IsNullOrWhiteSpace(methodName))
- throw new ArgumentNullOrEmptyException(nameof(methodName));
+ if (methodName == null) throw new ArgumentNullException(nameof(methodName));
+ if (string.IsNullOrWhiteSpace(methodName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(methodName));
// validate lambda type
var (lambdaDeclaring, lambdaParameters, lambdaReturned) = AnalyzeLambda(false, out var isFunction);
diff --git a/src/Umbraco.Core/RuntimeState.cs b/src/Umbraco.Core/RuntimeState.cs
index 42a48579df..851fb8ad47 100644
--- a/src/Umbraco.Core/RuntimeState.cs
+++ b/src/Umbraco.Core/RuntimeState.cs
@@ -1,8 +1,8 @@
using System;
-using System.Collections.Generic;
using System.Threading;
using System.Web;
using Semver;
+using Umbraco.Core.Collections;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Exceptions;
@@ -22,7 +22,7 @@ namespace Umbraco.Core
private readonly ILogger _logger;
private readonly IUmbracoSettingsSection _settings;
private readonly IGlobalSettings _globalSettings;
- private readonly HashSet _applicationUrls = new HashSet();
+ private readonly ConcurrentHashSet _applicationUrls = new ConcurrentHashSet();
private readonly Lazy _mainDom;
private readonly Lazy _serverRegistrar;
private readonly IUmbracoVersion _umbracoVersion;
diff --git a/src/Umbraco.Core/Security/BackOfficeUserStore.cs b/src/Umbraco.Core/Security/BackOfficeUserStore.cs
index 0d74ae2bb7..d9a9ac9424 100644
--- a/src/Umbraco.Core/Security/BackOfficeUserStore.cs
+++ b/src/Umbraco.Core/Security/BackOfficeUserStore.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Identity;
@@ -208,7 +207,8 @@ namespace Umbraco.Core.Security
{
ThrowIfDisposed();
if (user == null) throw new ArgumentNullException(nameof(user));
- if (string.IsNullOrEmpty(passwordHash)) throw new ArgumentNullOrEmptyException(nameof(passwordHash));
+ if (passwordHash == null) throw new ArgumentNullException(nameof(passwordHash));
+ if (string.IsNullOrEmpty(passwordHash)) throw new ArgumentException("Value can't be empty.", nameof(passwordHash));
user.PasswordHash = passwordHash;
@@ -320,7 +320,7 @@ namespace Umbraco.Core.Security
{
ThrowIfDisposed();
if (user == null) throw new ArgumentNullException(nameof(user));
- if (login == null) throw new ArgumentNullException("login");
+ if (login == null) throw new ArgumentNullException(nameof(login));
var logins = user.Logins;
var instance = new IdentityUserLogin(login.LoginProvider, login.ProviderKey, user.Id);
@@ -339,7 +339,7 @@ namespace Umbraco.Core.Security
{
ThrowIfDisposed();
if (user == null) throw new ArgumentNullException(nameof(user));
- if (login == null) throw new ArgumentNullException("login");
+ if (login == null) throw new ArgumentNullException(nameof(login));
var provider = login.LoginProvider;
var key = login.ProviderKey;
@@ -370,7 +370,7 @@ namespace Umbraco.Core.Security
public Task FindAsync(UserLoginInfo login)
{
ThrowIfDisposed();
- if (login == null) throw new ArgumentNullException("login");
+ if (login == null) throw new ArgumentNullException(nameof(login));
//get all logins associated with the login id
var result = _externalLoginService.Find(UserLoginInfoWrapper.Wrap(login)).ToArray();
@@ -404,7 +404,8 @@ namespace Umbraco.Core.Security
{
ThrowIfDisposed();
if (user == null) throw new ArgumentNullException(nameof(user));
- if (string.IsNullOrWhiteSpace(roleName)) throw new ArgumentException("Value cannot be null or whitespace.", "roleName");
+ if (roleName == null) throw new ArgumentNullException(nameof(roleName));
+ if (string.IsNullOrWhiteSpace(roleName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(roleName));
var userRole = user.Roles.SingleOrDefault(r => r.RoleId == roleName);
@@ -425,7 +426,8 @@ namespace Umbraco.Core.Security
{
ThrowIfDisposed();
if (user == null) throw new ArgumentNullException(nameof(user));
- if (string.IsNullOrWhiteSpace(roleName)) throw new ArgumentException("Value cannot be null or whitespace.", "roleName");
+ if (roleName == null) throw new ArgumentNullException(nameof(roleName));
+ if (string.IsNullOrWhiteSpace(roleName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(roleName));
var userRole = user.Roles.SingleOrDefault(r => r.RoleId == roleName);
diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs
index 82678f2889..8287c071f1 100644
--- a/src/Umbraco.Core/Services/Implement/ContentService.cs
+++ b/src/Umbraco.Core/Services/Implement/ContentService.cs
@@ -2884,7 +2884,8 @@ namespace Umbraco.Core.Services.Implement
private IContentType GetContentType(IScope scope, string contentTypeAlias)
{
- if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(contentTypeAlias));
+ if (contentTypeAlias == null) throw new ArgumentNullException(nameof(contentTypeAlias));
+ if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(contentTypeAlias));
scope.ReadLock(Constants.Locks.ContentTypes);
@@ -2899,7 +2900,8 @@ namespace Umbraco.Core.Services.Implement
private IContentType GetContentType(string contentTypeAlias)
{
- if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(contentTypeAlias));
+ if (contentTypeAlias == null) throw new ArgumentNullException(nameof(contentTypeAlias));
+ if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(contentTypeAlias));
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
index ad10a1371b..45baf9720f 100644
--- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
+++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
@@ -592,10 +592,9 @@ namespace Umbraco.Core.Services.Implement
public TItem Copy(TItem original, string alias, string name, TItem parent)
{
if (original == null) throw new ArgumentNullException(nameof(original));
- if (string.IsNullOrWhiteSpace(alias)) throw new ArgumentNullOrEmptyException(nameof(alias));
-
- if (parent != null && parent.HasIdentity == false)
- throw new InvalidOperationException("Parent must have an identity.");
+ if (alias == null) throw new ArgumentNullException(nameof(alias));
+ if (string.IsNullOrWhiteSpace(alias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(alias));
+ if (parent != null && parent.HasIdentity == false) throw new InvalidOperationException("Parent must have an identity.");
// this is illegal
//var originalb = (ContentTypeCompositionBase)original;
diff --git a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
index f488c12657..fa79883a0f 100644
--- a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
+++ b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
@@ -360,7 +360,9 @@ namespace Umbraco.Core.Services.Implement
new XElement("Definition", definition.Key),
new XElement("Tab", propertyGroup == null ? "" : propertyGroup.Name),
new XElement("Mandatory", propertyType.Mandatory.ToString()),
+ new XElement("MandatoryMessage", propertyType.MandatoryMessage),
new XElement("Validation", propertyType.ValidationRegExp),
+ new XElement("ValidationRegExpMessage", propertyType.ValidationRegExpMessage),
new XElement("Description", new XCData(propertyType.Description)));
genericProperties.Add(genericProperty);
}
@@ -487,7 +489,9 @@ namespace Umbraco.Core.Services.Implement
new XElement("Tab", propertyGroup == null ? "" : propertyGroup.Name),
new XElement("SortOrder", propertyType.SortOrder),
new XElement("Mandatory", propertyType.Mandatory.ToString()),
+ propertyType.MandatoryMessage != null ? new XElement("MandatoryMessage", propertyType.MandatoryMessage) : null,
propertyType.ValidationRegExp != null ? new XElement("Validation", propertyType.ValidationRegExp) : null,
+ propertyType.ValidationRegExpMessage != null ? new XElement("ValidationRegExpMessage", propertyType.ValidationRegExpMessage) : null,
propertyType.Description != null ? new XElement("Description", new XCData(propertyType.Description)) : null,
new XElement("Variations", propertyType.Variations.ToString()));
diff --git a/src/Umbraco.Core/Services/Implement/MediaService.cs b/src/Umbraco.Core/Services/Implement/MediaService.cs
index 7928379208..27e428d1d6 100644
--- a/src/Umbraco.Core/Services/Implement/MediaService.cs
+++ b/src/Umbraco.Core/Services/Implement/MediaService.cs
@@ -5,7 +5,6 @@ using System.Globalization;
using System.IO;
using System.Linq;
using Umbraco.Core.Events;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -1340,7 +1339,8 @@ namespace Umbraco.Core.Services.Implement
private IMediaType GetMediaType(string mediaTypeAlias)
{
- if (string.IsNullOrWhiteSpace(mediaTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(mediaTypeAlias));
+ if (mediaTypeAlias == null) throw new ArgumentNullException(nameof(mediaTypeAlias));
+ if (string.IsNullOrWhiteSpace(mediaTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(mediaTypeAlias));
using (var scope = ScopeProvider.CreateScope())
{
@@ -1350,7 +1350,7 @@ namespace Umbraco.Core.Services.Implement
var mediaType = _mediaTypeRepository.Get(query).FirstOrDefault();
if (mediaType == null)
- throw new Exception($"No MediaType matching the passed in Alias: '{mediaTypeAlias}' was found"); // causes rollback // causes rollback
+ throw new InvalidOperationException($"No media type matched the specified alias '{mediaTypeAlias}'.");
scope.Complete();
return mediaType;
diff --git a/src/Umbraco.Core/Services/Implement/MemberService.cs b/src/Umbraco.Core/Services/Implement/MemberService.cs
index f29a11cd27..8295d3ee55 100644
--- a/src/Umbraco.Core/Services/Implement/MemberService.cs
+++ b/src/Umbraco.Core/Services/Implement/MemberService.cs
@@ -1220,7 +1220,8 @@ namespace Umbraco.Core.Services.Implement
private IMemberType GetMemberType(IScope scope, string memberTypeAlias)
{
- if (string.IsNullOrWhiteSpace(memberTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(memberTypeAlias));
+ if (memberTypeAlias == null) throw new ArgumentNullException(nameof(memberTypeAlias));
+ if (string.IsNullOrWhiteSpace(memberTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(memberTypeAlias));
scope.ReadLock(Constants.Locks.MemberTypes);
@@ -1234,7 +1235,8 @@ namespace Umbraco.Core.Services.Implement
private IMemberType GetMemberType(string memberTypeAlias)
{
- if (string.IsNullOrWhiteSpace(memberTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(memberTypeAlias));
+ if (memberTypeAlias == null) throw new ArgumentNullException(nameof(memberTypeAlias));
+ if (string.IsNullOrWhiteSpace(memberTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(memberTypeAlias));
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs
index 7fd9be6dee..561b410786 100644
--- a/src/Umbraco.Core/Services/Implement/PackagingService.cs
+++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs
@@ -61,7 +61,7 @@ namespace Umbraco.Core.Services.Implement
}
catch (HttpRequestException ex)
{
- throw new ConnectionException("An error occurring downloading the package from " + url, ex);
+ throw new HttpRequestException("An error occurring downloading the package from " + url, ex);
}
//successful
diff --git a/src/Umbraco.Core/Services/Implement/UserService.cs b/src/Umbraco.Core/Services/Implement/UserService.cs
index 6569ef03e7..128b33c6c2 100644
--- a/src/Umbraco.Core/Services/Implement/UserService.cs
+++ b/src/Umbraco.Core/Services/Implement/UserService.cs
@@ -6,7 +6,6 @@ using System.Linq;
using System.Linq.Expressions;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence.Querying;
@@ -102,7 +101,8 @@ namespace Umbraco.Core.Services.Implement
///
private IUser CreateUserWithIdentity(string username, string email, string passwordValue, bool isApproved = true)
{
- if (string.IsNullOrWhiteSpace(username)) throw new ArgumentNullOrEmptyException(nameof(username));
+ if (username == null) throw new ArgumentNullException(nameof(username));
+ if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(username));
// TODO: PUT lock here!!
diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs
index 1a84124dde..b7baa8cd60 100644
--- a/src/Umbraco.Core/StringExtensions.cs
+++ b/src/Umbraco.Core/StringExtensions.cs
@@ -3,7 +3,6 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Umbraco.Core.Composing;
-using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Strings;
@@ -106,7 +105,8 @@ namespace Umbraco.Core
/// The safe url segment.
public static string ToUrlSegment(this string text)
{
- if (string.IsNullOrWhiteSpace(text)) throw new ArgumentNullOrEmptyException(nameof(text));
+ if (text == null) throw new ArgumentNullException(nameof(text));
+ if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
return Current.ShortStringHelper.CleanStringForUrlSegment(text);
}
@@ -119,7 +119,8 @@ namespace Umbraco.Core
/// The safe url segment.
public static string ToUrlSegment(this string text, string culture)
{
- if (string.IsNullOrWhiteSpace(text)) throw new ArgumentNullOrEmptyException(nameof(text));
+ if (text == null) throw new ArgumentNullException(nameof(text));
+ if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
return Current.ShortStringHelper.CleanStringForUrlSegment(text, culture);
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index a92f09e096..79a486b5f1 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -188,6 +188,7 @@
+
@@ -239,8 +240,6 @@
-
-
@@ -795,7 +794,6 @@
-
diff --git a/src/Umbraco.Tests/CoreThings/EnumExtensionsTests.cs b/src/Umbraco.Tests/CoreThings/EnumExtensionsTests.cs
index 72a55cee85..4a0c1d0f41 100644
--- a/src/Umbraco.Tests/CoreThings/EnumExtensionsTests.cs
+++ b/src/Umbraco.Tests/CoreThings/EnumExtensionsTests.cs
@@ -51,5 +51,47 @@ namespace Umbraco.Tests.CoreThings
else
Assert.IsFalse(value.HasFlagAny(test));
}
+
+ [TestCase(TreeUse.None, TreeUse.None, TreeUse.None)]
+ [TestCase(TreeUse.None, TreeUse.Main, TreeUse.Main)]
+ [TestCase(TreeUse.None, TreeUse.Dialog, TreeUse.Dialog)]
+ [TestCase(TreeUse.None, TreeUse.Main | TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main, TreeUse.None, TreeUse.Main)]
+ [TestCase(TreeUse.Main, TreeUse.Main, TreeUse.Main)]
+ [TestCase(TreeUse.Main, TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main, TreeUse.Main | TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Dialog, TreeUse.None, TreeUse.Dialog)]
+ [TestCase(TreeUse.Dialog, TreeUse.Main, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Dialog, TreeUse.Dialog, TreeUse.Dialog)]
+ [TestCase(TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.None, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.Main, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog)]
+ public void SetFlagTests(TreeUse value, TreeUse flag, TreeUse expected)
+ {
+ Assert.AreEqual(expected, value.SetFlag(flag));
+ }
+
+ [TestCase(TreeUse.None, TreeUse.None, TreeUse.None)]
+ [TestCase(TreeUse.None, TreeUse.Main, TreeUse.None)]
+ [TestCase(TreeUse.None, TreeUse.Dialog, TreeUse.None)]
+ [TestCase(TreeUse.None, TreeUse.Main | TreeUse.Dialog, TreeUse.None)]
+ [TestCase(TreeUse.Main, TreeUse.None, TreeUse.Main)]
+ [TestCase(TreeUse.Main, TreeUse.Main, TreeUse.None)]
+ [TestCase(TreeUse.Main, TreeUse.Dialog, TreeUse.Main)]
+ [TestCase(TreeUse.Main, TreeUse.Main | TreeUse.Dialog, TreeUse.None)]
+ [TestCase(TreeUse.Dialog, TreeUse.None, TreeUse.Dialog)]
+ [TestCase(TreeUse.Dialog, TreeUse.Main, TreeUse.Dialog)]
+ [TestCase(TreeUse.Dialog, TreeUse.Dialog, TreeUse.None)]
+ [TestCase(TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog, TreeUse.None)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.None, TreeUse.Main | TreeUse.Dialog)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.Main, TreeUse.Dialog)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.Dialog, TreeUse.Main)]
+ [TestCase(TreeUse.Main | TreeUse.Dialog, TreeUse.Main | TreeUse.Dialog, TreeUse.None)]
+ public void UnsetFlagTests(TreeUse value, TreeUse flag, TreeUse expected)
+ {
+ Assert.AreEqual(expected, value.UnsetFlag(flag));
+ }
}
}
diff --git a/src/Umbraco.Tests/IO/PhysicalFileSystemTests.cs b/src/Umbraco.Tests/IO/PhysicalFileSystemTests.cs
index 85fa79fc0a..283f32bee3 100644
--- a/src/Umbraco.Tests/IO/PhysicalFileSystemTests.cs
+++ b/src/Umbraco.Tests/IO/PhysicalFileSystemTests.cs
@@ -103,7 +103,7 @@ namespace Umbraco.Tests.IO
Assert.AreEqual(Path.Combine(basePath, @"foo\bar.tmp"), path);
// that path is invalid as it would be outside the root directory
- Assert.Throws(() => _fileSystem.GetFullPath("../../foo.tmp"));
+ Assert.Throws(() => _fileSystem.GetFullPath("../../foo.tmp"));
// a very long path, which ends up being very long, works
path = Repeat("bah/bah/", 50);
diff --git a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs
index c73de56835..7e68761491 100644
--- a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs
+++ b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs
@@ -250,7 +250,7 @@ namespace Umbraco.Tests.IO
var sfs = new PhysicalFileSystem(ioHelper, Current.Logger, path + "/ShadowSystem/", "ignore");
var ss = new ShadowFileSystem(fs, sfs);
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
ss.AddFile("../../f1.txt", ms);
diff --git a/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs
index 7274ebcc98..be562241b2 100644
--- a/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs
+++ b/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs
@@ -622,7 +622,9 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation()
{
Mandatory = true,
- Pattern = "xyz"
+ MandatoryMessage = "Please enter a value",
+ Pattern = "xyz",
+ PatternMessage = "Please match the pattern",
}
};
@@ -635,7 +637,9 @@ namespace Umbraco.Tests.Models.Mapping
Assert.AreEqual(basic.DataTypeId, result.DataTypeId);
Assert.AreEqual(basic.Label, result.Name);
Assert.AreEqual(basic.Validation.Mandatory, result.Mandatory);
+ Assert.AreEqual(basic.Validation.MandatoryMessage, result.MandatoryMessage);
Assert.AreEqual(basic.Validation.Pattern, result.ValidationRegExp);
+ Assert.AreEqual(basic.Validation.PatternMessage, result.ValidationRegExpMessage);
}
[Test]
@@ -656,7 +660,9 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation()
{
Mandatory = true,
- Pattern = "xyz"
+ MandatoryMessage = "Please enter a value",
+ Pattern = "xyz",
+ PatternMessage = "Please match the pattern",
}
};
@@ -669,7 +675,9 @@ namespace Umbraco.Tests.Models.Mapping
Assert.AreEqual(basic.DataTypeId, result.DataTypeId);
Assert.AreEqual(basic.Label, result.Name);
Assert.AreEqual(basic.Validation.Mandatory, result.Mandatory);
+ Assert.AreEqual(basic.Validation.MandatoryMessage, result.MandatoryMessage);
Assert.AreEqual(basic.Validation.Pattern, result.ValidationRegExp);
+ Assert.AreEqual(basic.Validation.PatternMessage, result.ValidationRegExpMessage);
}
[Test]
@@ -952,7 +960,7 @@ namespace Umbraco.Tests.Models.Mapping
Name = "Tab 1",
SortOrder = 0,
Inherited = false,
- Properties = new []
+ Properties = new[]
{
new MemberPropertyTypeBasic
{
@@ -966,7 +974,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
@@ -1001,7 +1009,7 @@ namespace Umbraco.Tests.Models.Mapping
Name = "Tab 1",
SortOrder = 0,
Inherited = false,
- Properties = new []
+ Properties = new[]
{
new PropertyTypeBasic
{
@@ -1012,7 +1020,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
@@ -1053,7 +1061,7 @@ namespace Umbraco.Tests.Models.Mapping
Name = "Tab 1",
SortOrder = 0,
Inherited = false,
- Properties = new []
+ Properties = new[]
{
new PropertyTypeBasic
{
@@ -1064,7 +1072,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
@@ -1110,7 +1118,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
@@ -1134,7 +1142,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
@@ -1188,7 +1196,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
@@ -1212,7 +1220,7 @@ namespace Umbraco.Tests.Models.Mapping
Validation = new PropertyTypeValidation
{
Mandatory = false,
- Pattern = ""
+ Pattern = string.Empty
},
SortOrder = 0,
DataTypeId = 555
diff --git a/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs b/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs
index 4b57b96bb8..4c57bd3b83 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs
@@ -9,6 +9,7 @@ using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Persistence.Repositories.Implement;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.Testing;
+using System;
namespace Umbraco.Tests.Persistence.Repositories
{
@@ -79,7 +80,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);
partialView = new PartialView(PartialViewType.PartialView, "\\test-path-4.cshtml") { Content = "// partialView" };
- Assert.Throws(() => // fixed in 7.3 - 7.2.8 used to strip the \
+ Assert.Throws(() => // fixed in 7.3 - 7.2.8 used to strip the \
{
repository.Save(partialView);
});
@@ -88,11 +89,11 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.IsNull(partialView);
// fixed in 7.3 - 7.2.8 used to...
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
partialView = (PartialView) repository.Get("\\test-path-4.cshtml"); // outside the filesystem, does not exist
});
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
partialView = (PartialView) repository.Get("../../packages.config"); // outside the filesystem, exists
});
diff --git a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs
index dc654a2c52..8d7a166f26 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
using System.Linq;
using System.Text;
using Moq;
@@ -310,7 +311,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.AreEqual("/scripts/path-2/test-path-3.js", script.VirtualPath);
script = new Script("\\test-path-4.js") { Content = "// script" };
- Assert.Throws(() => // fixed in 7.3 - 7.2.8 used to strip the \
+ Assert.Throws(() => // fixed in 7.3 - 7.2.8 used to strip the \
{
repository.Save(script);
});
@@ -319,11 +320,11 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.IsNull(script);
// fixed in 7.3 - 7.2.8 used to...
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
script = repository.Get("\\test-path-4.js"); // outside the filesystem, does not exist
});
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
script = repository.Get("../packages.config"); // outside the filesystem, exists
});
diff --git a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs
index 3106c1692c..c2fbb63442 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs
@@ -1,4 +1,5 @@
-using System.Data;
+using System;
+using System.Data;
using System.IO;
using System.Linq;
using System.Text;
@@ -293,7 +294,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.AreEqual("/css/path-2/test-path-3.css", stylesheet.VirtualPath);
stylesheet = new Stylesheet("\\test-path-4.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" };
- Assert.Throws(() => // fixed in 7.3 - 7.2.8 used to strip the \
+ Assert.Throws(() => // fixed in 7.3 - 7.2.8 used to strip the \
{
repository.Save(stylesheet);
});
@@ -303,11 +304,11 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.IsNull(stylesheet);
// fixed in 7.3 - 7.2.8 used to...
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
stylesheet = repository.Get("\\test-path-4.css"); // outside the filesystem, does not exist
});
- Assert.Throws(() =>
+ Assert.Throws(() =>
{
stylesheet = repository.Get("../packages.config"); // outside the filesystem, exists
});
diff --git a/src/Umbraco.Tests/Published/NestedContentTests.cs b/src/Umbraco.Tests/Published/NestedContentTests.cs
index 4d99aa86d8..cc1035f61f 100644
--- a/src/Umbraco.Tests/Published/NestedContentTests.cs
+++ b/src/Umbraco.Tests/Published/NestedContentTests.cs
@@ -266,7 +266,7 @@ namespace Umbraco.Tests.Published
public override bool HasValue(string culture = null, string segment = null) => _hasValue;
public override object GetSourceValue(string culture = null, string segment = null) => _sourceValue;
public override object GetValue(string culture = null, string segment = null) => PropertyType.ConvertInterToObject(_owner, ReferenceCacheLevel, InterValue, _preview);
- public override object GetXPathValue(string culture = null, string segment = null) => throw new WontImplementException();
+ public override object GetXPathValue(string culture = null, string segment = null) => throw new InvalidOperationException("This method won't be implemented.");
}
}
}
diff --git a/src/Umbraco.Tests/Services/UserServiceTests.cs b/src/Umbraco.Tests/Services/UserServiceTests.cs
index cce54c81a4..a96385a923 100644
--- a/src/Umbraco.Tests/Services/UserServiceTests.cs
+++ b/src/Umbraco.Tests/Services/UserServiceTests.cs
@@ -865,7 +865,7 @@ namespace Umbraco.Tests.Services
var userService = ServiceContext.UserService;
// Act & Assert
- Assert.Throws(() => userService.CreateUserWithIdentity(string.Empty, "john@umbraco.io"));
+ Assert.Throws(() => userService.CreateUserWithIdentity(string.Empty, "john@umbraco.io"));
}
[Test]
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js
index 06b9e51fba..31e797c6b4 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js
@@ -4,7 +4,7 @@
* @restrict E
**/
angular.module("umbraco.directives")
- .directive('umbProperty', function (umbPropEditorHelper, userService) {
+ .directive('umbProperty', function (userService) {
return {
scope: {
property: "=",
@@ -17,7 +17,7 @@ angular.module("umbraco.directives")
templateUrl: 'views/components/property/umb-property.html',
link: function (scope) {
- scope.propertyEditorAPI = {};
+ scope.propertyActions = [];
userService.getCurrentUser().then(function (u) {
var isAdmin = u.userGroups.indexOf('admin') !== -1;
@@ -25,28 +25,20 @@ angular.module("umbraco.directives")
});
},
//Define a controller for this directive to expose APIs to other directives
- controller: function ($scope, $timeout) {
+ controller: function ($scope) {
var self = this;
-
+
//set the API properties/methods
self.property = $scope.property;
self.setPropertyError = function (errorMsg) {
$scope.property.propertyErrorMessage = errorMsg;
};
-
- var unsubscribe = $scope.$on("ExposePropertyEditorAPI", function(event, api) {
-
- //avoid eventual parent properties to capture this.
- event.stopPropagation();
-
- $scope.propertyEditorAPI = api;
- });
- $scope.$on("$destroy", function () {
- unsubscribe();
- });
+ self.setPropertyActions = function(actions) {
+ $scope.propertyActions = actions;
+ };
}
};
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js
index 2bd93a4b27..3d743c7e9a 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js
@@ -65,6 +65,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
vm.reloadNode = reloadNode;
vm.syncTree = syncTree;
vm.loadChildren = loadChildren;
+ vm.hasTree = hasTree;
//wire up the exposed api object for hosting controllers
if ($scope.api) {
@@ -72,6 +73,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
$scope.api.load = vm.load;
$scope.api.reloadNode = vm.reloadNode;
$scope.api.syncTree = vm.syncTree;
+ $scope.api.hasTree = vm.hasTree;
}
//flag to track the last loaded section when the tree 'un-loads'. We use this to determine if we should
@@ -203,6 +205,25 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
});
}
+ //given a tree alias, this will search the current section tree for the specified tree alias and set the current active tree to it's root node
+ function hasTree(treeAlias) {
+
+ if (!$scope.tree) {
+ throw "Err in umbtree.directive.loadActiveTree, $scope.tree is null";
+ }
+
+ if (!treeAlias) {
+ return false;
+ }
+
+ var treeRoots = getTreeRootNodes();
+ var foundTree = _.find(treeRoots, function (node) {
+ return node.metaData.treeAlias.toUpperCase() === treeAlias.toUpperCase();
+ });
+
+ return foundTree !== undefined;
+ }
+
//given a tree alias, this will search the current section tree for the specified tree alias and set the current active tree to it's root node
function loadActiveTree(treeAlias) {
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js
index 07b690ad2b..3c9e300f92 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js
@@ -549,7 +549,9 @@
property.dataTypeIcon = propertyModel.dataTypeIcon;
property.dataTypeName = propertyModel.dataTypeName;
property.validation.mandatory = propertyModel.validation.mandatory;
+ property.validation.mandatoryMessage = propertyModel.validation.mandatoryMessage;
property.validation.pattern = propertyModel.validation.pattern;
+ property.validation.patternMessage = propertyModel.validation.patternMessage;
property.showOnMemberProfile = propertyModel.showOnMemberProfile;
property.memberCanEdit = propertyModel.memberCanEdit;
property.isSensitiveValue = propertyModel.isSensitiveValue;
@@ -632,7 +634,9 @@
propertyState: "init",
validation: {
mandatory: false,
- pattern: null
+ mandatoryMessage: null,
+ pattern: null,
+ patternMessage: null
}
};
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js
index ce70e9f543..8d1caab850 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js
@@ -338,6 +338,22 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
});
},
+ /**
+ * @ngdoc method
+ * @name umbraco.services.navigationService#hasTree
+ * @methodOf umbraco.services.navigationService
+ *
+ * @description
+ * Checks if a tree with the given alias exists.
+ *
+ * @param {String} treeAlias the tree alias to check
+ */
+ hasTree: function (treeAlias) {
+ return navReadyPromise.promise.then(function () {
+ return mainTreeApi.hasTree(treeAlias);
+ });
+ },
+
/**
Internal method that should ONLY be used by the legacy API wrapper, the legacy API used to
have to set an active tree and then sync, the new API does this in one method by using syncTree
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/overlay.service.js b/src/Umbraco.Web.UI.Client/src/common/services/overlay.service.js
index 0b8965e4fe..119f40e114 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/overlay.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/overlay.service.js
@@ -89,6 +89,7 @@
}
function confirmDelete(overlay) {
+ overlay.confirmType = "delete";
confirm(overlay);
}
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/propertyeditor.service.js b/src/Umbraco.Web.UI.Client/src/common/services/propertyeditor.service.js
deleted file mode 100644
index 0b24e78567..0000000000
--- a/src/Umbraco.Web.UI.Client/src/common/services/propertyeditor.service.js
+++ /dev/null
@@ -1,29 +0,0 @@
-(function() {
- 'use strict';
-
- function propertyEditorService() {
- /**
- * @ngdoc function
- * @name umbraco.services.propertyEditorService#expose
- * @methodOf umbraco.services.propertyEditorService
- * @function
- *
- * @param {object} scope An object containing API for the PropertyEditor
- */
- function exposeAPI(scope, api) {
- if (!scope) {
- throw "scope cannot be null";
- }
- if (!api) {
- throw "api cannot be null";
- }
- scope.$emit("ExposePropertyEditorAPI", api);
- }
-
- return {
- exposeAPI: exposeAPI
- };
- }
-
- angular.module('umbraco.services').factory('propertyEditorService', propertyEditorService);
-})();
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tabbable.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tabbable.service.js
index 3782128af6..35f0d8a34a 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/tabbable.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/tabbable.service.js
@@ -184,7 +184,13 @@
});
if (cached) return cached[1];
- nodeComputedStyle = nodeComputedStyle || this.doc.defaultView.getComputedStyle(node);
+ if (!nodeComputedStyle) {
+ if (node instanceof DocumentFragment) {
+ return true;// though DocumentFragment doesn't directly have display 'none', we know that it will never be visible, and therefore we return true. (and do not cache this, cause it will change if appended to the DOM)
+ } else {
+ nodeComputedStyle = this.doc.defaultView.getComputedStyle(node);
+ }
+ }
var result = false;
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/validationmessage.service.js b/src/Umbraco.Web.UI.Client/src/common/services/validationmessage.service.js
new file mode 100644
index 0000000000..5e0d8b876b
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/common/services/validationmessage.service.js
@@ -0,0 +1,34 @@
+(function () {
+ 'use strict';
+
+ function validationMessageService($q, localizationService) {
+
+ // Gets the message to use for when a mandatory field isn't completed.
+ // Will either use the one provided on the property type's validation object
+ // or a localised default.
+ function getMandatoryMessage(validation) {
+ if (!validation) {
+ return $q.when("");
+ }
+
+ if (validation.mandatoryMessage) {
+ return $q.when(validation.mandatoryMessage);
+ } else {
+ return localizationService.localize("general_required").then(function (value) {
+ return $q.when(value);
+ });
+ }
+ }
+
+ var service = {
+ getMandatoryMessage: getMandatoryMessage
+ };
+
+ return service;
+
+ }
+
+ angular.module('umbraco.services').factory('validationMessageService', validationMessageService);
+
+
+})();
diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less
index c51fd37fe4..f9d8772d45 100644
--- a/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less
+++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less
@@ -493,11 +493,11 @@ input.umb-group-builder__group-sort-value {
font-weight: bold;
font-size: 14px;
color: @ui-action-type;
-
- &:hover{
+
+ &:hover {
text-decoration: none;
- color:@ui-action-type-hover;
- border-color:@ui-action-border-hover;
+ color: @ui-action-type-hover;
+ border-color: @ui-action-border-hover;
}
}
@@ -554,7 +554,13 @@ input.umb-group-builder__group-sort-value {
overflow: hidden;
}
- .editor-validation-pattern{
+ .editor-validation-message {
+ min-width: 100%;
+ min-height: 25px;
+ margin-top: 4px;
+ }
+
+ .editor-validation-pattern {
border: 1px solid @gray-7;
margin: 10px 0 0;
padding: 6px;
diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less
index 455a147395..bf0dd9d109 100644
--- a/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less
+++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less
@@ -14,6 +14,17 @@
pointer-events: none;
}
+.umb-nested-content--mandatory {
+ /*
+ yeah so this is a pain, but we must be super specific in targeting the mandatory property labels,
+ otherwise all properties within a reqired, nested, nested content property will all appear mandatory
+ */
+ > ng-form > .control-group > .umb-el-wrap > .control-header label:after {
+ content: '*';
+ color: @red;
+ }
+}
+
.umb-nested-content-overlay {
position: absolute;
top: 0;
@@ -134,6 +145,8 @@
.umb-nested-content__icon {
+ background: transparent;
+ border: 0 none;
display: inline-block;
padding: 4px;
margin: 2px;
@@ -235,7 +248,6 @@
}
.umb-nested-content__placeholder {
- height: 22px;
padding: 4px 6px;
border: 1px dashed #d8d7d9;
background: 0 0;
@@ -246,33 +258,18 @@
text-align: center;
&--selected {
- border: 1px solid #d8d7d9;
+ border: none;
text-align: left;
+ padding: 0;
}
}
-.umb-nested-content__placeholder-name{
- font-size: 15px;
-}
-
.umb-nested-content__placeholder:hover {
color: #2152a3;
border-color: #2152a3;
text-decoration: none;
}
-.umb-nested-content__placeholder-icon-holder {
- width: 20px;
- text-align: center;
- display: inline-block;
-}
-
-.umb-nested-content__placeholder-icon {
- font-size: 18px;
- vertical-align: middle;
-}
-
-
.form-horizontal .umb-nested-content--narrow .controls-row {
margin-left: 40% !important;
}
diff --git a/src/Umbraco.Web.UI.Client/src/less/forms.less b/src/Umbraco.Web.UI.Client/src/less/forms.less
index cfbb8b78ab..72abb3ba00 100644
--- a/src/Umbraco.Web.UI.Client/src/less/forms.less
+++ b/src/Umbraco.Web.UI.Client/src/less/forms.less
@@ -528,7 +528,8 @@ input[type="checkbox"][readonly] {
.help-inline {
display: inline-block;
vertical-align: middle;
- padding-left: 5px;
+ padding-top: 4px;
+ padding-left: 2px;
}
div.help {
diff --git a/src/Umbraco.Web.UI.Client/src/less/properties.less b/src/Umbraco.Web.UI.Client/src/less/properties.less
index 152ea49bbd..8523fe9300 100644
--- a/src/Umbraco.Web.UI.Client/src/less/properties.less
+++ b/src/Umbraco.Web.UI.Client/src/less/properties.less
@@ -97,7 +97,8 @@
.history-line {
width: 2px;
- height: 100%;
+ top: 10px;
+ bottom: 10px;
margin: 0 0 0 14px;
background-color: @gray-8;
position: absolute;
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/propertysettings/propertysettings.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/propertysettings/propertysettings.html
index fab6ba4069..4474390199 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/propertysettings/propertysettings.html
+++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/propertysettings/propertysettings.html
@@ -81,39 +81,55 @@
-
- Required
- {{datePickerForm.datepicker.errorMsg}}
- Invalid date
-
+
+
{{mandatoryMessage}}
+
{{datePickerForm.datepicker.errorMsg}}
+
Invalid date
+
This translates to the following time on the server: {{serverTime}}
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js
index 3b341f7ac0..a6d615cdd1 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js
@@ -1,5 +1,5 @@
angular.module("umbraco").controller("Umbraco.PropertyEditors.DropdownFlexibleController",
- function($scope) {
+ function ($scope, validationMessageService) {
//setup the default config
var config = {
@@ -89,4 +89,10 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.DropdownFlexibleCo
$scope.model.value = null;
}
}
+
+ // Set the message to use for when a mandatory field isn't completed.
+ // Will either use the one provided on the property type or a localised default.
+ validationMessageService.getMandatoryMessage($scope.model.validation).then(function (value) {
+ $scope.mandatoryMessage = value;
+ });
});
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.html
index 5f873e9e43..1059df2994 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.html
@@ -1,21 +1,29 @@
-
+
+
+
-
-
+
+
+
+
+
{{mandatoryMessage}}
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.controller.js
new file mode 100644
index 0000000000..7ed7531bc5
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.controller.js
@@ -0,0 +1,10 @@
+function emailController($scope, validationMessageService) {
+
+ // Set the message to use for when a mandatory field isn't completed.
+ // Will either use the one provided on the property type or a localised default.
+ validationMessageService.getMandatoryMessage($scope.model.validation).then(function(value) {
+ $scope.mandatoryMessage = value;
+ });
+
+}
+angular.module('umbraco').controller("Umbraco.PropertyEditors.EmailController", emailController);
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.html
index 881ad37d7c..26ec22df8d 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/email/email.html
@@ -1,4 +1,4 @@
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.html
index 7104f48ee9..0564c22057 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.html
@@ -1,73 +1,5 @@
-
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.propertyeditor.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.propertyeditor.html
new file mode 100644
index 0000000000..d24d3796f3
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.propertyeditor.html
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Minimum %0% entries, needs %1% more.
+
+
+
+
+ Maximum %0% entries, %1% too many.
+
+
+
+
+
+
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.controller.js
index 0618c5e22b..2db7eaf562 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.controller.js
@@ -1,5 +1,5 @@
angular.module("umbraco").controller("Umbraco.PropertyEditors.RadioButtonsController",
- function ($scope) {
+ function ($scope, validationMessageService) {
var vm = this;
@@ -23,6 +23,12 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.RadioButtonsContro
vm.viewItems = sortedItems;
}
+
+ // Set the message to use for when a mandatory field isn't completed.
+ // Will either use the one provided on the property type or a localised default.
+ validationMessageService.getMandatoryMessage($scope.model.validation).then(function (value) {
+ $scope.mandatoryMessage = value;
+ });
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.html
index ad006b4992..1c3aa898db 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.html
@@ -1,7 +1,15 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
{{mandatoryMessage}}
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js
index 45df813835..884cc62d43 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js
@@ -1,4 +1,4 @@
-function textAreaController($scope) {
+function textAreaController($scope, validationMessageService) {
// macro parameter editor doesn't contains a config object,
// so we create a new one to hold any properties
@@ -22,5 +22,11 @@ function textAreaController($scope) {
}
}
$scope.model.change();
+
+ // Set the message to use for when a mandatory field isn't completed.
+ // Will either use the one provided on the property type or a localised default.
+ validationMessageService.getMandatoryMessage($scope.model.validation).then(function (value) {
+ $scope.mandatoryMessage = value;
+ });
}
angular.module('umbraco').controller("Umbraco.PropertyEditors.textAreaController", textAreaController);
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html
index 4842a6bfb7..04bd8590d2 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html
@@ -3,7 +3,7 @@
- Required
+ {{mandatoryMessage}}{{textareaFieldForm.textarea.errorMsg}}
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js
index 32e9891eb4..e86d8caef4 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js
@@ -1,4 +1,4 @@
-function textboxController($scope) {
+function textboxController($scope, validationMessageService) {
// macro parameter editor doesn't contains a config object,
// so we create a new one to hold any properties
if (!$scope.model.config) {
@@ -18,6 +18,11 @@ function textboxController($scope) {
}
}
$scope.model.change();
-
+
+ // Set the message to use for when a mandatory field isn't completed.
+ // Will either use the one provided on the property type or a localised default.
+ validationMessageService.getMandatoryMessage($scope.model.validation).then(function(value) {
+ $scope.mandatoryMessage = value;
+ });
}
angular.module('umbraco').controller("Umbraco.PropertyEditors.textboxController", textboxController);
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html
index f8f9b18c7f..e1f5dac733 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html
@@ -12,7 +12,7 @@
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
index 974b1af707..0deac8b50f 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
@@ -272,6 +272,7 @@
Dette oversætter til den følgende tid på serveren:Hvad betyder det?]]>Er du sikker på, at du vil slette dette element?
+ Er du sikker på, at du vil slette alle elementer?Egenskaben %0% anvender editoren %1% som ikke er understøttet af Nested Content.Der er ikke konfigureret nogen indholdstyper for denne egenskab.%0% fra %1%
@@ -1772,6 +1773,7 @@ Mange hilsner fra Umbraco robotten
Kopier %0%%0% fra %1%
+ Fjern alle elementerÅben egenskabshandlinger
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
index 653974a6fe..c64d2d3eb0 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
@@ -1,2336 +1,2340 @@
-
-
-
- The Umbraco community
- https://our.umbraco.com/documentation/Extending-Umbraco/Language-Files
-
-
- Culture and Hostnames
- Audit Trail
- Browse Node
- Change Document Type
- Copy
- Create
- Export
- Create Package
- Create group
- Delete
- Disable
- Empty recycle bin
- Enable
- Export Document Type
- Import Document Type
- Import Package
- Edit in Canvas
- Exit
- Move
- Notifications
- Public access
- Publish
- Unpublish
- Reload
- Republish entire site
- Rename
- Restore
- Set permissions for the page %0%
- Choose where to copy
- Choose where to move
- to in the tree structure below
- was moved to
- was copied to
- was deleted
- Permissions
- Rollback
- Send To Publish
- Send To Translation
- Set group
- Sort
- Translate
- Update
- Set permissions
- Unlock
- Create Content Template
- Resend Invitation
-
-
- Content
- Administration
- Structure
- Other
-
-
- Allow access to assign culture and hostnames
- Allow access to view a node's history log
- Allow access to view a node
- Allow access to change document type for a node
- Allow access to copy a node
- Allow access to create nodes
- Allow access to delete nodes
- Allow access to move a node
- Allow access to set and change public access for a node
- Allow access to publish a node
- Allow access to unpublish a node
- Allow access to change permissions for a node
- Allow access to roll back a node to a previous state
- Allow access to send a node for approval before publishing
- Allow access to send a node for translation
- Allow access to change the sort order for nodes
- Allow access to translate a node
- Allow access to save a node
- Allow access to create a Content Template
-
-
- Content
- Info
-
-
- Permission denied.
- Add new Domain
- remove
- Invalid node.
- One or more domains have an invalid format.
- Domain has already been assigned.
- Language
- Domain
- New domain '%0%' has been created
- Domain '%0%' is deleted
- Domain '%0%' has already been assigned
- Domain '%0%' has been updated
- Edit Current Domains
-
-
- Inherit
- Culture
-
- or inherit culture from parent nodes. Will also apply
- to the current node, unless a domain below applies too.]]>
-
- Domains
-
-
- Clear selection
- Select
- Do something else
- Bold
- Cancel Paragraph Indent
- Insert form field
- Insert graphic headline
- Edit Html
- Indent Paragraph
- Italic
- Center
- Justify Left
- Justify Right
- Insert Link
- Insert local link (anchor)
- Bullet List
- Numeric List
- Insert macro
- Insert picture
- Publish and close
- Publish with descendants
- Edit relations
- Return to list
- Save
- Save and close
- Save and publish
- Save and schedule
- Save and send for approval
- Save list view
- Schedule
- Preview
- Preview is disabled because there's no template assigned
- Choose style
- Show styles
- Insert table
- Save and generate models
- Undo
- Redo
- Delete tag
- Cancel
- Confirm
- More publishing options
-
-
- Viewing for
- Content deleted
- Content unpublished
- Content saved and Published
- Content saved and published for languages: %0%
- Content saved
- Content saved for languages: %0%
- Content moved
- Content copied
- Content rolled back
- Content sent for publishing
- Content sent for publishing for languages: %0%
- Sort child items performed by user
- Copy
- Publish
- Publish
- Move
- Save
- Save
- Delete
- Unpublish
- Rollback
- Send To Publish
- Send To Publish
- Sort
- History (all variants)
-
-
- To change the document type for the selected content, first select from the list of valid types for this location.
- Then confirm and/or amend the mapping of properties from the current type to the new, and click Save.
- The content has been re-published.
- Current Property
- Current type
- The document type cannot be changed, as there are no alternatives valid for this location. An alternative will be valid if it is allowed under the parent of the selected content item and that all existing child content items are allowed to be created under it.
- Document Type Changed
- Map Properties
- Map to Property
- New Template
- New Type
- none
- Content
- Select New Document Type
- The document type of the selected content has been successfully changed to [new type] and the following properties mapped:
- to
- Could not complete property mapping as one or more properties have more than one mapping defined.
- Only alternate types valid for the current location are displayed.
-
-
- Failed to create a folder under parent with ID %0%
- Failed to create a folder under parent with name %0%
- The folder name cannot contain illegal characters.
- Failed to delete item: %0%
-
-
- Is Published
- About this page
- Alias
- (how would you describe the picture over the phone)
- Alternative Links
- Click to edit this item
- Created by
- Original author
- Updated by
- Created
- Date/time this document was created
- Document Type
- Editing
- Remove at
- This item has been changed after publication
- This item is not published
- Last published
- There are no items to show
- There are no items to show in the list.
- No content has been added
- No members have been added
- Media Type
- Link to media item(s)
- Member Group
- Role
- Member Type
- No changes have been made
- No date chosen
- Page title
- This media item has no link
- Properties
- This document is published but is not visible because the parent '%0%' is unpublished
- This culture is published but is not visible because it is unpublished on parent '%0%'
- This document is published but is not in the cache
- Could not get the url
- This document is published but its url would collide with content %0%
- This document is published but its url cannot be routed
- Publish
- Published
- Published (pending changes)
- Publication Status
- Publish with descendants to publish %0% and all content items underneath and thereby making their content publicly available.]]>
- Publish with descendants to publish the selected languages and the same languages of content items underneath and thereby making their content publicly available.]]>
- Publish at
- Unpublish at
- Clear Date
- Set date
- Sortorder is updated
- To sort the nodes, simply drag the nodes or click one of the column headers. You can select multiple nodes by holding the "shift" or "control" key while selecting
- Statistics
- Title (optional)
- Alternative text (optional)
- Type
- Unpublish
- Unpublished
- Last edited
- Date/time this document was edited
- Remove file(s)
- Link to document
- Member of group(s)
- Not a member of group(s)
- Child items
- Target
- This translates to the following time on the server:
- What does this mean?]]>
- Are you sure you want to delete this item?
- Property %0% uses editor %1% which is not supported by Nested Content.
- No content types are configured for this property.
- Add element type
- Select element type
- Add another text box
- Remove this text box
- Content root
- Include drafts: also publish unpublished content items.
- This value is hidden. If you need access to view this value please contact your website administrator.
- This value is hidden.
- What languages would you like to publish? All languages with content are saved!
- What languages would you like to publish?
- What languages would you like to save?
- All languages with content are saved on creation!
- What languages would you like to send for approval?
- What languages would you like to schedule?
- Select the languages to unpublish. Unpublishing a mandatory language will unpublish all languages.
- Published Languages
- Unpublished Languages
- Unmodified Languages
- These languages haven't been created
- Ready to Publish?
- Ready to Save?
- Send for approval
- Select the date and time to publish and/or unpublish the content item.
- Create new
- Paste from clipboard
-
-
- Create a new Content Template from '%0%'
- Blank
- Select a Content Template
- Content Template created
- A Content Template was created from '%0%'
- Another Content Template with the same name already exists
- A Content Template is predefined content that an editor can select to use as the basis for creating new content
-
-
- Click to upload
- or click here to choose files
- You can drag files here to upload
- Cannot upload this file, it does not have an approved file type
- Max file size is
- Media root
- Failed to move media
- Failed to copy media
- Failed to create a folder under parent id %0%
- Failed to rename the folder with id %0%
- Drag and drop your file(s) into the area
-
-
- Create a new member
- All Members
- Member groups have no additional properties for editing.
-
-
- Where do you want to create the new %0%
- Create an item under
- Select the document type you want to make a content template for
- Enter a folder name
- Choose a type and a title
- Document Types within the Settings section, by editing the Allowed child node types under Permissions.]]>
- Document Types within the Settings section.]]>
- The selected page in the content tree doesn't allow for any pages to be created below it.
- Edit permissions for this document type
- Create a new document type
- Document Types within the Settings section, by changing the Allow as root option under Permissions.]]>
- Media Types Types within the Settings section, by editing the Allowed child node types under Permissions.]]>
- The selected media in the tree doesn't allow for any other media to be created below it.
- Edit permissions for this media type
- Document Type without a template
- New folder
- New data type
- New JavaScript file
- New empty partial view
- New partial view macro
- New partial view from snippet
- New partial view macro from snippet
- New partial view macro (without macro)
- New style sheet file
- New Rich Text Editor style sheet file
-
-
- Browse your website
- - Hide
- If Umbraco isn't opening, you might need to allow popups from this site
- has opened in a new window
- Restart
- Visit
- Welcome
-
-
- Stay
- Discard changes
- You have unsaved changes
- Are you sure you want to navigate away from this page? - you have unsaved changes
- Publishing will make the selected items visible on the site.
- Unpublishing will remove the selected items and all their descendants from the site.
- Unpublishing will remove this page and all its descendants from the site.
- You have unsaved changes. Making changes to the Document Type will discard the changes.
-
-
- Done
- Deleted %0% item
- Deleted %0% items
- Deleted %0% out of %1% item
- Deleted %0% out of %1% items
- Published %0% item
- Published %0% items
- Published %0% out of %1% item
- Published %0% out of %1% items
- Unpublished %0% item
- Unpublished %0% items
- Unpublished %0% out of %1% item
- Unpublished %0% out of %1% items
- Moved %0% item
- Moved %0% items
- Moved %0% out of %1% item
- Moved %0% out of %1% items
- Copied %0% item
- Copied %0% items
- Copied %0% out of %1% item
- Copied %0% out of %1% items
-
-
- Link title
- Link
- Anchor / querystring
- Name
- Manage hostnames
- Close this window
- Are you sure you want to delete
- Are you sure you want to disable
- Are you sure?
- Are you sure?
- Cut
- Edit Dictionary Item
- Edit Language
- Edit selected media
- Insert local link
- Insert character
- Insert graphic headline
- Insert picture
- Insert link
- Click to add a Macro
- Insert table
- This will delete the language
- Changing the culture for a language may be an expensive operation and will result in the content cache and indexes being rebuilt
- Last Edited
- Link
- Internal link:
- When using local links, insert "#" in front of link
- Open in new window?
- Macro Settings
- This macro does not contain any properties you can edit
- Paste
- Edit permissions for
- Set permissions for
- Set permissions for %0% for user group %1%
- Select the users groups you want to set permissions for
- The items in the recycle bin are now being deleted. Please do not close this window while this operation takes place
- The recycle bin is now empty
- When items are deleted from the recycle bin, they will be gone forever
- regexlib.com's webservice is currently experiencing some problems, which we have no control over. We are very sorry for this inconvenience.]]>
- Search for a regular expression to add validation to a form field. Example: 'email, 'zip-code' 'url'
- Remove Macro
- Required Field
- Site is reindexed
- The website cache has been refreshed. All publish content is now up to date. While all unpublished content is still unpublished
- The website cache will be refreshed. All published content will be updated, while unpublished content will stay unpublished.
- Number of columns
- Number of rows
- Click on the image to see full size
- Pick item
- View Cache Item
- Relate to original
- Include descendants
- The friendliest community
- Link to page
- Opens the linked document in a new window or tab
- Link to media
- Select content start node
- Select media
- Select media type
- Select icon
- Select item
- Select link
- Select macro
- Select content
- Select content type
- Select media start node
- Select member
- Select member group
- Select member type
- Select node
- Select sections
- Select users
- No icons were found
- There are no parameters for this macro
- There are no macros available to insert
- External login providers
- Exception Details
- Stacktrace
- Inner Exception
- Link your
- Un-link your
- account
- Select editor
- Select snippet
- This will delete the node and all its languages. If you only want to delete one language, you should unpublish the node in that language instead.
-
-
- There are no dictionary items.
-
-
- %0%' below
- ]]>
- Culture Name
-
- Dictionary overview
-
-
- Configured Searchers
- Shows properties and tools for any configured Searcher (i.e. such as a multi-index searcher)
- Field values
- Health status
- The health status of the index and if it can be read
- Indexers
- Index info
- Lists the properties of the index
- Manage Examine's indexes
- Allows you to view the details of each index and provides some tools for managing the indexes
- Rebuild index
-
- Depending on how much content there is in your site this could take a while.
- It is not recommended to rebuild an index during times of high website traffic or when editors are editing content.
- ]]>
-
- Searchers
- Search the index and view the results
- Tools
- Tools to manage the index
- fields
- The index cannot be read and will need to be rebuilt
- The process is taking longer than expected, check the umbraco log to see if there have been any errors during this operation
- This index cannot be rebuilt because it has no assigned
- IIndexPopulator
-
-
- Enter your username
- Enter your password
- Confirm your password
- Name the %0%...
- Enter a name...
- Enter an email...
- Enter a username...
- Label...
- Enter a description...
- Type to search...
- Type to filter...
- Type to add tags (press enter after each tag)...
- Enter your email
- Enter a message...
- Your username is usually your email
- #value or ?key=value
- Enter alias...
- Generating alias...
- Create item
- Create
- Edit
- Name
-
-
- Create custom list view
- Remove custom list view
- A content type, media type or member type with this alias already exists
-
-
- Renamed
- Enter a new folder name here
- %0% was renamed to %1%
-
-
- Add prevalue
- Database datatype
- Property editor GUID
- Property editor
- Buttons
- Enable advanced settings for
- Enable context menu
- Maximum default size of inserted images
- Related stylesheets
- Show label
- Width and height
- All property types & property data
- using this data type will be deleted permanently, please confirm you want to delete these as well
- Yes, delete
- and all property types & property data using this data type
- Select the folder to move
- to in the tree structure below
- was moved underneath
-
-
- Your data has been saved, but before you can publish this page there are some errors you need to fix first:
- The current membership provider does not support changing password (EnablePasswordRetrieval need to be true)
- %0% already exists
- There were errors:
- There were errors:
- The password should be a minimum of %0% characters long and contain at least %1% non-alpha numeric character(s)
- %0% must be an integer
- The %0% field in the %1% tab is mandatory
- %0% is a mandatory field
- %0% at %1% is not in a correct format
- %0% is not in a correct format
-
-
- Received an error from the server
- The specified file type has been disallowed by the administrator
- NOTE! Even though CodeMirror is enabled by configuration, it is disabled in Internet Explorer because it's not stable enough.
- Please fill both alias and name on the new property type!
- There is a problem with read/write access to a specific file or folder
- Error loading Partial View script (file: %0%)
- Please enter a title
- Please choose a type
- You're about to make the picture larger than the original size. Are you sure that you want to proceed?
- Startnode deleted, please contact your administrator
- Please mark content before changing style
- No active styles available
- Please place cursor at the left of the two cells you wish to merge
- You cannot split a cell that hasn't been merged.
- This property is invalid
-
-
- About
- Action
- Actions
- Add
- Alias
- All
- Are you sure?
- Back
- Back to overview
- Border
- by
- Cancel
- Cell margin
- Choose
- Close
- Close Window
- Comment
- Confirm
- Constrain
- Constrain proportions
- Content
- Continue
- Copy
- Create
- Database
- Date
- Default
- Delete
- Deleted
- Deleting...
- Design
- Dictionary
- Dimensions
- Down
- Download
- Edit
- Edited
- Elements
- Email
- Error
- Field
- Find
- First
- Focal point
- General
- Groups
- Group
- Height
- Help
- Hide
- History
- Icon
- Id
- Import
- Include subfolders in search
- Info
- Inner margin
- Insert
- Install
- Invalid
- Justify
- Label
- Language
- Last
- Layout
- Links
- Loading
- Locked
- Login
- Log off
- Logout
- Macro
- Mandatory
- Message
- Move
- Name
- New
- Next
- No
- of
- Off
- OK
- Open
- Options
- On
- or
- Order by
- Password
- Path
- One moment please...
- Previous
- Properties
- Rebuild
- Email to receive form data
- Recycle Bin
- Your recycle bin is empty
- Reload
- Remaining
- Remove
- Rename
- Renew
- Required
- Retrieve
- Retry
- Permissions
- Scheduled Publishing
- Search
- Sorry, we can not find what you are looking for.
- No items have been added
- Server
- Settings
- Show
- Show page on Send
- Size
- Sort
- Status
- Submit
- Type
- Type to search...
- under
- Up
- Update
- Upgrade
- Upload
- Url
- User
- Username
- Value
- View
- Welcome...
- Width
- Yes
- Folder
- Search results
- Reorder
- I am done reordering
- Preview
- Change password
- to
- List view
- Saving...
- current
- Embed
- selected
-
-
- Blue
-
-
- Add group
- Add property
- Add editor
- Add template
- Add child node
- Add child
- Edit data type
- Navigate sections
- Shortcuts
- show shortcuts
- Toggle list view
- Toggle allow as root
- Comment/Uncomment lines
- Remove line
- Copy Lines Up
- Copy Lines Down
- Move Lines Up
- Move Lines Down
- General
- Editor
- Toggle allow culture variants
-
-
- Background colour
- Bold
- Text colour
- Font
- Text
-
-
- Page
-
-
- The installer cannot connect to the database.
- Could not save the web.config file. Please modify the connection string manually.
- Your database has been found and is identified as
- Database configuration
-
- install button to install the Umbraco %0% database
- ]]>
-
- Next to proceed.]]>
- Database not found! Please check that the information in the "connection string" of the "web.config" file is correct.
-
To proceed, please edit the "web.config" file (using Visual Studio or your favourite text editor), scroll to the bottom, add the connection string for your database in the key named "UmbracoDbDSN" and save the file.
]]>
-
- Please contact your ISP if necessary.
- If you're installing on a local machine or server you might need information from your system administrator.]]>
-
- Press the upgrade button to upgrade your database to Umbraco %0%
-
- Don't worry - no content will be deleted and everything will continue working afterwards!
-
- ]]>
- Press Next to
- proceed. ]]>
- next to continue the configuration wizard]]>
- The Default users' password needs to be changed!]]>
- The Default user has been disabled or has no access to Umbraco!
No further actions needs to be taken. Click Next to proceed.]]>
- The Default user's password has been successfully changed since the installation!
No further actions needs to be taken. Click Next to proceed.]]>
- The password is changed!
- Get a great start, watch our introduction videos
- By clicking the next button (or modifying the umbracoConfigurationStatus in web.config), you accept the license for this software as specified in the box below. Notice that this Umbraco distribution consists of two different licenses, the open source MIT license for the framework and the Umbraco freeware license that covers the UI.
- Not installed yet.
- Affected files and folders
- More information on setting up permissions for Umbraco here
- You need to grant ASP.NET modify permissions to the following files/folders
- Your permission settings are almost perfect!
- You can run Umbraco without problems, but you will not be able to install packages which are recommended to take full advantage of Umbraco.]]>
- How to Resolve
- Click here to read the text version
- video tutorial on setting up folder permissions for Umbraco or read the text version.]]>
- Your permission settings might be an issue!
-
- You can run Umbraco without problems, but you will not be able to create folders or install packages which are recommended to take full advantage of Umbraco.]]>
- Your permission settings are not ready for Umbraco!
-
- In order to run Umbraco, you'll need to update your permission settings.]]>
- Your permission settings are perfect!
- You are ready to run Umbraco and install packages!]]>
- Resolving folder issue
- Follow this link for more information on problems with ASP.NET and creating folders
- Setting up folder permissions
-
- I want to start from scratch
- learn how)
- You can still choose to install Runway later on. Please go to the Developer section and choose Packages.
- ]]>
- You've just set up a clean Umbraco platform. What do you want to do next?
- Runway is installed
-
- This is our list of recommended modules, check off the ones you would like to install, or view the full list of modules
- ]]>
- Only recommended for experienced users
- I want to start with a simple website
-
- "Runway" is a simple website providing some basic document types and templates. The installer can set up Runway for you automatically,
- but you can easily edit, extend or remove it. It's not necessary and you can perfectly use Umbraco without it. However,
- Runway offers an easy foundation based on best practices to get you started faster than ever.
- If you choose to install Runway, you can optionally select basic building blocks called Runway Modules to enhance your Runway pages.
-
-
- Included with Runway: Home page, Getting Started page, Installing Modules page.
- Optional Modules: Top Navigation, Sitemap, Contact, Gallery.
-
- ]]>
- What is Runway
- Step 1/5 Accept license
- Step 2/5: Database configuration
- Step 3/5: Validating File Permissions
- Step 4/5: Check Umbraco security
- Step 5/5: Umbraco is ready to get you started
- Thank you for choosing Umbraco
- Browse your new site
-You installed Runway, so why not see how your new website looks.]]>
- Further help and information
-Get help from our award winning community, browse the documentation or watch some free videos on how to build a simple site, how to use packages and a quick guide to the Umbraco terminology]]>
- Umbraco %0% is installed and ready for use
- /web.config file and update the AppSetting key UmbracoConfigurationStatus in the bottom to the value of '%0%'.]]>
- started instantly by clicking the "Launch Umbraco" button below. If you are new to Umbraco,
-you can find plenty of resources on our getting started pages.]]>
- Launch Umbraco
-To manage your website, simply open the Umbraco back office and start adding content, updating the templates and stylesheets or add new functionality]]>
- Connection to database failed.
- Umbraco Version 3
- Umbraco Version 4
- Watch
- Umbraco %0% for a fresh install or upgrading from version 3.0.
-