This project is read-only.

ValidateGreaterThan

Description: Indicates a property must be greater than another property.

Constructor(s):
  • public ValidateGreaterThanAttribute(string propertyName, string message)

Parameters:
  • propertyName: The name of the property to compare.
  • message: The message to be used if validation fails.

Example Usage:
public class MyEntity : EvilBaseEntity
{
    [ValidateGreaterThan("Property2", "Property1 must be greater than Property2.")]
    public int Property1
    {
        // Omitted for brevity
    }

    public int Property2
    {
        // Omitted for brevity
    }
}


Valid Entity:
MyEntity entity = new MyEntity();
entity.Property1 = 10;
entity.Property2 = 9;

bool result = entity.IsValid();


Invalid Entity 1:
MyEntity entity = new MyEntity();
entity.Property1 = 9;
entity.Property2 = 10;

bool result = entity.IsValid();


Invalid Entity 2:
MyEntity entity = new MyEntity();
entity.Property1 = 10;
entity.Property2 = 10;

bool result = entity.IsValid();

Last edited Dec 11, 2006 at 2:48 PM by Arcware, version 2

Comments

No comments yet.