- Fixed MR-84
[castle.git] / MonoRail / TestSiteARSupport / Model / ProductLicense.cs
blob6059739bf49469220ae741286d3d37a74ba887b0
1 // Copyright 2004-2007 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 TestSiteARSupport.Model
17 using System;
19 using Castle.ActiveRecord;
21 using Iesi.Collections;
23 [ActiveRecord("TSAS_ProdLicense")]
24 public class ProductLicense : ActiveRecordBase
26 private int id;
27 private DateTime created;
28 private DateTime expires;
29 private ISet accounts = new ListSet();
31 public ProductLicense()
33 created = DateTime.Now;
34 expires = DateTime.Now.AddDays(1);
37 [PrimaryKey]
38 public int Id
40 get { return id; }
41 set { id = value; }
44 [Property(Update=false, Insert=true)]
45 public DateTime Created
47 get { return created; }
48 set { created = value; }
51 [Property]
52 public DateTime Expires
54 get { return expires; }
55 set { expires = value; }
58 [HasMany(typeof(Account), Inverse=false)]
59 public ISet Accounts
61 get { return accounts; }
62 set { accounts = value; }
65 public override string ToString()
67 return String.Format("License Created at {0} Expires at {1}",
68 created.ToShortDateString(), expires.ToShortDateString());
71 public static ProductLicense[] FindAll()
73 return (ProductLicense[]) ActiveRecordBase.FindAll(typeof(ProductLicense));