|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace System.Core.Validation
{
/// <summary>
/// Base class for implementing validation attributes
/// </summary>
public abstract class ValidatorAttributeBase : Attribute
{
#region Private Fields
private string _errorMessage;
private uint _sequenceNr;
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the error message.
/// </summary>
/// <value>The error message.</value>
public string ErrorMessage
{
get { return _errorMessage; }
set { _errorMessage = value; }
}
/// <summary>
/// Gets or sets the sequence of validation for this property
/// </summary>
/// <value>The order.</value>
public uint Sequence
{
get { return _sequenceNr; }
set { _sequenceNr = value; }
}
#endregion
#region Public Methods
/// <summary>
/// Creates a validator corresponding to the the type of validator attribute
/// </summary>
/// <param name="propertyType">The property type.</param>
/// <param name="propertyName">The name of the property for to create the validator.</param>
/// <returns></returns>
public abstract ValidatorBase CreateValidator(Type propertyType,string propertyName);
#endregion
#region Constructor(s)
/// <summary>
/// Initializes a new instance of the <see cref="ValidatorAttributeBase"/> class.
/// </summary>
public ValidatorAttributeBase()
{
this._errorMessage = null;
this._sequenceNr = 0;
}
#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.
I'm a 39 year old software developer living in Norway.
I'm currently working for a software company making software for the retail industry.