Permalink
Browse files

a sample

  • Loading branch information...
1 parent c9c421a commit f2e9039114a8257588a4c6511af9b582ce3b4d34 @adrianaisemberg adrianaisemberg committed Oct 25, 2011
Showing with 28 additions and 0 deletions.
  1. +28 −0 ConsoleTest/Program.cs
View
@@ -655,5 +655,33 @@ public class PhoneNumber
public string Type { get; set; }
public string Number { get; set; }
}
+
+ // Validate properties of this class
+ [Validate("Name NOT LIKE 'Banana*'")]
+ public class Product
+ {
+ // Validate the value of this property
+ [RegexMatches("#PP[0-9]*")]
+ public string ID { get; set; }
+
+ // Validate the value of this property
+ [MoreOrEqualTo(0)]
+ public int Index { get; set; }
+
+ public string Name { get; set; }
+
+ // Validate the properties of the value of this property
+ [Validate("Name NOT IN 'Adrian'")]
+ public ProductReview Review { get; set; }
+ }
+
+ public class ProductReview
+ {
+ public string Name { get; set; }
+
+ // Validate the value of this property
+ [RegexMatches(@"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$")]
+ public string Email { get; set; }
+ }
}

0 comments on commit f2e9039

Please sign in to comment.