Fix the build.
[castle.git] / Samples / MonoRail / GettingStartedSampleVS2005 / GettingStartedSample / Models / Product.cs
blob55f47f098e83ff60e4a14e5b60ce94e87ac6b01c
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 GettingStartedSample.Models
17 using System;
18 using Castle.ActiveRecord;
20 [ActiveRecord]
21 public class Product : ActiveRecordBase
23 private int id;
24 private String name;
25 private decimal price;
26 private Supplier supplier;
28 [PrimaryKey]
29 public int Id
31 get { return id; }
32 set { id = value; }
35 [Property]
36 public string Name
38 get { return name; }
39 set { name = value; }
42 [Property]
43 public decimal Price
45 get { return price; }
46 set { price = value; }
49 [BelongsTo("SupplierId")]
50 public Supplier Supplier
52 get { return supplier; }
53 set { supplier = value; }
56 public static Product[] FindAll()
58 return (Product[]) FindAll(typeof(Product));
61 public static Product FindById(int id)
63 return (Product) FindByPrimaryKey(typeof(Product), id);