|
using System;
using System.Runtime.Serialization;
namespace Cobalt.Validation
{
/// <summary>
/// Can optionally use this exception to throw an exception from the middle tier when asked to perform an operation on an invalid object. For example, if an invalid object makes it to the data access code, a data mapper could could throw a ValidationException when it is asked to save an object that is invalid. This is more descriptive than throwing an <see cref="InvalidOperationException"/>.
/// </summary>
[Serializable]
public class ValidationException : InvalidOperationException
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ValidationException"/> class.
/// </summary>
public ValidationException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ValidationException"/> class.
/// </summary>
public ValidationException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ValidationException"/> class.
/// </summary>
protected ValidationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ValidationException"/> class.
/// </summary>
public ValidationException()
{
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I work at a financial services firm using mostly .NET. I enjoy my job immensely and love teaching, training, and mentoring younger developers.