1 // Copyright 2004-2007 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 MoreComplexSample
18 using Castle
.ActiveRecord
;
19 using Iesi
.Collections
.Generic
;
21 public enum OrderStatus
: short
29 [ActiveRecord("`Order`")]
30 public class Order
: ActiveRecordBase
33 private DateTime createdAt
;
34 private DateTime
? dispatchedAt
;
35 private Customer customer
;
36 private OrderStatus status
;
38 private ISet
<Product
> products
= new HashedSet
<Product
>();
42 createdAt
= DateTime
.Now
;
45 [PrimaryKey(PrimaryKeyType
.Native
)]
52 [Property(Update
=false)]
53 public DateTime CreatedAt
55 get { return createdAt; }
56 set { createdAt = value; }
59 [Property(Insert
=false)]
60 public DateTime
? DispatchedAt
62 get { return dispatchedAt; }
63 set { dispatchedAt = value; }
66 [BelongsTo("CustomerId")]
67 public Customer Customer
69 get { return customer; }
70 set { customer = value; }
77 set { total = value; }
81 public OrderStatus Status
83 get { return status; }
84 set { status = value; }
89 ColumnKey
="OrderId", ColumnRef
="ProductId", Inverse
= true, Lazy
= true)]
90 public ISet
<Product
> Products
92 get { return products; }
93 set { products = value; }