Added container accessor to Castle.Core
[castle.git] / Samples / Castle / PetStore.Model / Order.cs
blob8845e6f1b990f3225b524113c5feb74121b83753
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 PetStore.Model
17 using System;
19 using Castle.ActiveRecord;
21 using Iesi.Collections;
24 [ActiveRecord]
25 public class Order : ActiveRecordBase
27 private int id;
28 private decimal total;
29 private DateTime creation;
30 private Customer customer;
31 private ISet items = new HashedSet();
33 public Order()
35 creation = DateTime.Now;
38 [PrimaryKey]
39 public int Id
41 get { return id; }
42 set { id = value; }
45 [Property]
46 public DateTime Creation
48 get { return creation; }
49 set { creation = value; }
52 [Property]
53 public decimal Total
55 get { return total; }
56 set { total = value; }
59 [BelongsTo("customer_id")]
60 public Customer Customer
62 get { return customer; }
63 set { customer = value; }
66 [HasMany( typeof(OrderItem) )]
67 public ISet Items
69 get { return items; }
70 set { items = value; }