Added RedirectUsingNamedRoute
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / OtherDbBlog.cs
blob7afb462b770b162118ceb721ab44e61f5a7638ca
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
17 using System;
18 using System.Collections;
20 using Castle.ActiveRecord.Tests.Model;
23 [ActiveRecord("BlogTable")]
24 public class OtherDbBlog : Test2ARBase
26 private int _id;
27 private String _name;
28 private String _author;
29 private IList _posts;
30 private IList _publishedposts;
31 private IList _unpublishedposts;
32 private IList _recentposts;
34 [PrimaryKey(PrimaryKeyType.Native)]
35 public int Id
37 get { return _id; }
38 set { _id = value; }
41 [Property]
42 public String Name
44 get { return _name; }
45 set { _name = value; }
48 [Property]
49 public String Author
51 get { return _author; }
52 set { _author = value; }
55 [HasMany(typeof(OtherDbPost), Table="Posts", ColumnKey="blogid")]
56 public IList Posts
58 get { return _posts; }
59 set { _posts = value; }
62 [HasMany(typeof (OtherDbPost), Table="Posts", ColumnKey="blogid", Where="published = 1")]
63 public IList PublishedPosts
65 get { return _publishedposts; }
66 set { _publishedposts = value; }
69 [HasMany(typeof (OtherDbPost), Table="Posts", ColumnKey="blogid", Where="published = 0")]
70 public IList UnPublishedPosts
72 get { return _unpublishedposts; }
73 set { _unpublishedposts = value; }
76 [HasMany(typeof (OtherDbPost), Table="Posts", ColumnKey="blogid", OrderBy="created desc")]
77 public IList RecentPosts
79 get { return _recentposts; }
80 set { _recentposts = value; }
83 public static void DeleteAll()
85 ActiveRecordMediator.DeleteAll(typeof (OtherDbBlog));
88 public static OtherDbBlog[] FindAll()
90 return (OtherDbBlog[]) ActiveRecordMediator.FindAll(typeof (OtherDbBlog));
93 public static OtherDbBlog Find(int id)
95 return (OtherDbBlog) ActiveRecordMediator.FindByPrimaryKey(typeof (OtherDbBlog), id);