|
using System;
using System.Collections.Generic;
using System.Text;
namespace System.Core.Validation
{
public class RequiredValidator : ValidatorBase
{
public RequiredValidator(Type propertyType, string propertyName)
: this(propertyType, propertyName, null)
{
}
public RequiredValidator(Type propertyType, string propertyName, string errorMessage) : base(propertyType, propertyName, errorMessage)
{
if (string.IsNullOrEmpty(errorMessage))
this.ErrorMessage = string.Format(DefaultErrorMessages.Required, propertyName);
}
protected override bool Validate(object value)
{
return value != null;
}
protected override Type[] ValidPropertyTypes
{
get { return null; }
}
}
}
|
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.