Core.Attempt - maintain backward compatibility

This commit is contained in:
Stephan
2013-09-05 13:34:43 +02:00
parent 85ab96f71a
commit 9ca048f0ad

View File

@@ -27,6 +27,13 @@ namespace Umbraco.Core
/// </summary>
public Exception Exception { get { return _exception; } }
/// <summary>
/// Gets the exception associated with an unsuccessful attempt.
/// </summary>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete(".Error is obsolete, you should use .Exception instead.", false)]
public Exception Error { get { return _exception; } }
/// <summary>
/// Gets the attempt result.
/// </summary>
@@ -38,6 +45,13 @@ namespace Umbraco.Core
// optimize, use a singleton failed attempt
private static readonly Attempt<T> Failed = new Attempt<T>(false, default(T), null);
/// <summary>
/// Represents an unsuccessful attempt.
/// </summary>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete(".Failed is obsolete, you should use Attempt<T>.Fail() instead.", false)]
public static readonly Attempt<T> False = Failed;
// private - use Succ() or Fail() methods to create attempts
private Attempt(bool success, T result, Exception exception)
{
@@ -46,6 +60,27 @@ namespace Umbraco.Core
_exception = exception;
}
/// <summary>
/// Initialize a new instance of the <see cref="Attempt{T}"/> struct with a result.
/// </summary>
/// <param name="success">A value indicating whether the attempt is successful.</param>
/// <param name="result">The result of the attempt.</param>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete("Attempt ctors are obsolete, you should use Attempt<T>.Succ(), Attempt<T>.Fail() or Attempt<T>.If() instead.", false)]
public Attempt(bool success, T result)
: this(success, result, null)
{ }
/// <summary>
/// Initialize a new instance of the <see cref="Attempt{T}"/> struct representing a failed attempt, with an exception.
/// </summary>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete("Attempt ctors are obsolete, you should use Attempt<T>.Succ(), Attempt<T>.Fail() or Attempt<T>.If() instead.", false)]
public Attempt(Exception exception)
: this(false, default(T), exception)
{ }
/// <summary>
/// Creates a successful attempt.
/// </summary>