1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.ActiveRecord
.Tests
.Validation
.Model
19 [ActiveRecord("Blogs2")]
20 public class Blog2
: ActiveRecordValidationBase
24 private String _author
;
26 [PrimaryKey(PrimaryKeyType
.Native
)]
33 [Property
, ValidateIsUnique
]
37 set { _name = value; }
43 get { return _author; }
44 set { _author = value; }
47 public static void DeleteAll()
49 DeleteAll( typeof(Blog2
) );
52 public static Blog2
[] FindAll()
54 return (Blog2
[]) FindAll( typeof(Blog2
) );
57 public static Blog2
Find(int id
)
59 return (Blog2
) FindByPrimaryKey( typeof(Blog2
), id
);
63 [ActiveRecord("Blogs2")]
64 public class Blog2B
: ActiveRecordValidationBase
68 private String _author
;
70 [PrimaryKey(PrimaryKeyType
.Native
)]
81 set { _name = value; }
87 get { return _author; }
88 set { _author = value; }
91 public static void DeleteAll()
93 DeleteAll( typeof(Blog2
) );
96 public static Blog2
[] FindAll()
98 return (Blog2
[]) FindAll( typeof(Blog2
) );
101 public static Blog2
Find(int id
)
103 return (Blog2
) FindByPrimaryKey( typeof(Blog2
), id
);
107 [ActiveRecord("Blogs3")]
108 public class Blog3
: ActiveRecordValidationBase
111 private String _name
;
112 private String _author
;
114 [PrimaryKey(PrimaryKeyType
.Assigned
)]
115 [ValidateIsUnique("The ID you specified already exists.")]
125 get { return _name; }
126 set { _name = value; }
132 get { return _author; }
133 set { _author = value; }
136 public static void DeleteAll()
138 DeleteAll( typeof(Blog3
) );
141 public static Blog3
[] FindAll()
143 return (Blog3
[]) FindAll( typeof(Blog3
) );
146 public static Blog3
Find(int id
)
148 return (Blog3
) FindByPrimaryKey( typeof(Blog3
), id
);
152 [ActiveRecord("Blogs4")]
153 public class Blog4
: ActiveRecordValidationBase
156 private String _name
;
157 private String _author
;
159 [PrimaryKey(PrimaryKeyType
.Native
)]
166 [Property
, ValidateIsUnique
]
169 get { return _name; }
170 set { _name = value; }
176 get { return _author; }
177 set { _author = value; }
180 public static void DeleteAll()
182 DeleteAll(typeof(Blog4
));
185 public static Blog4
[] FindAll()
187 return (Blog4
[])FindAll(typeof(Blog4
));
190 public static Blog4
Find(int id
)
192 return (Blog4
)FindByPrimaryKey(typeof(Blog4
), id
);
196 [ActiveRecord("Blogs2")]
197 public class Blog5
: ActiveRecordBase
200 private String _name
;
201 private String _author
;
203 [PrimaryKey(PrimaryKeyType
.Native
)]
213 get { return _name; }
214 set { _name = value; }
220 get { return _author; }
221 set { _author = value; }