Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Validation / Model / Blog.cs
blobed7c7230956c48db9f53921cabf09851a122a9bb
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
19 [ActiveRecord("Blogs2")]
20 public class Blog2 : ActiveRecordValidationBase
22 private int _id;
23 private String _name;
24 private String _author;
26 [PrimaryKey(PrimaryKeyType.Native)]
27 public int Id
29 get { return _id; }
30 set { _id = value; }
33 [Property, ValidateIsUnique]
34 public String Name
36 get { return _name; }
37 set { _name = value; }
40 [Property]
41 public String Author
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
66 private int _id;
67 private String _name;
68 private String _author;
70 [PrimaryKey(PrimaryKeyType.Native)]
71 public int Id
73 get { return _id; }
74 set { _id = value; }
77 [Property]
78 public String Name
80 get { return _name; }
81 set { _name = value; }
84 [Property]
85 public String Author
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
110 private String _id;
111 private String _name;
112 private String _author;
114 [PrimaryKey(PrimaryKeyType.Assigned)]
115 [ValidateIsUnique("The ID you specified already exists.")]
116 public String Id
118 get { return _id; }
119 set { _id = value; }
122 [Property]
123 public String Name
125 get { return _name; }
126 set { _name = value; }
129 [Property]
130 public String Author
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
155 private int? _id;
156 private String _name;
157 private String _author;
159 [PrimaryKey(PrimaryKeyType.Native)]
160 public int? Id
162 get { return _id; }
163 set { _id = value; }
166 [Property, ValidateIsUnique]
167 public String Name
169 get { return _name; }
170 set { _name = value; }
173 [Property]
174 public String Author
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
199 private int _id;
200 private String _name;
201 private String _author;
203 [PrimaryKey(PrimaryKeyType.Native)]
204 public int Id
206 get { return _id; }
207 set { _id = value; }
210 [Property]
211 public String Name
213 get { return _name; }
214 set { _name = value; }
217 [Property]
218 public String Author
220 get { return _author; }
221 set { _author = value; }