ValidateMultipleOf

Description: Indicates a property must be a multiple of another property.

Constructor(s):
  • public ValidateMultipleOfAttribute(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
{
    [ValidateMultipleOf("Property2", "Property1 must be a multiple of Property2.")]
    public long Property1
    {
        // Omitted for brevity
    }

    public long Property2
    {
        // Omitted for brevity
    }
}


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

bool result = entity.IsValid();


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

bool result = entity.IsValid();

Last edited Dec 7, 2006 at 2:53 PM by Arcware, version 1

Comments

No comments yet.