Applied patch from Jan Limpens 'ReflectionBasedDictionaryAdapter needs to check if...
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / NestedValidation / UserWithNestedAddress.cs
blob09e73eecf0ff8d68a4c04386444e9ae7a7afea4a
1 namespace Castle.ActiveRecord.Tests.Model.NestedValidation
3 using Castle.Components.Validator;
5 [ActiveRecord]
6 public class UserWithNestedAddress : ActiveRecordValidationBase<UserWithNestedAddress>
8 private int id;
9 private string email;
10 private Address postalAddress = new Address();
11 private Address billingAddress;
13 [PrimaryKey(PrimaryKeyType.Native)]
14 public int Id
16 get { return id; }
17 set { id = value; }
20 [Property]
21 [ValidateNonEmpty, ValidateLength(5, 5)]
22 public string Email
24 get { return email;}
25 set { email = value; }
28 [Nested]
29 public Address PostalAddress
31 get { return postalAddress; }
32 set { postalAddress = value; }
35 [Nested]
36 public Address BillingAddress {
37 get { return billingAddress; }
38 set { billingAddress = value; }
42 [ActiveRecord]
43 public class UserWithNestedAddressNonGeneric : ActiveRecordValidationBase
45 private int id;
46 private string email;
47 private Address postalAddress = new Address();
48 private Address billingAddress;
50 [PrimaryKey(PrimaryKeyType.Native)]
51 public int Id {
52 get { return id; }
53 set { id = value; }
56 [Property]
57 [ValidateNonEmpty, ValidateLength(5, 5)]
58 public string Email {
59 get { return email; }
60 set { email = value; }
63 [Nested]
64 public Address PostalAddress {
65 get { return postalAddress; }
66 set { postalAddress = value; }
69 [Nested]
70 public Address BillingAddress {
71 get { return billingAddress; }
72 set { billingAddress = value; }
76 public class Address
78 private string addressLine1;
79 private string country;
81 [Property]
82 [ValidateNonEmpty, ValidateLength(5,5)]
83 public string AddressLine1
85 get { return addressLine1; }
86 set { addressLine1 = value; }
89 [Property]
90 [ValidateNonEmpty]
91 public string Country
93 get { return country;}
94 set { country = value; }