1 // Copyright 2004-2008 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 Castle
.ActiveRecord
.Tests
.Model
.LazyModel
19 using Iesi
.Collections
;
23 public class ProductLazy
: ActiveRecordValidationBase
26 private ISet categories
= new HashedSet();
39 [HasMany( typeof(CategoryLazy
), Lazy
=true, Cascade
=ManyRelationCascadeEnum
.All
)]
40 public ISet Categories
42 get { return categories; }
43 set { categories = value; }
46 public static void DeleteAll()
48 ActiveRecordBase
.DeleteAll( typeof(ProductLazy
) );
51 public static ProductLazy
[] FindAll()
53 return (ProductLazy
[]) ActiveRecordBase
.FindAll( typeof(ProductLazy
) );
56 public static ProductLazy
Find(int id
)
58 return (ProductLazy
) ActiveRecordBase
.FindByPrimaryKey( typeof(ProductLazy
), id
);
63 public class CategoryLazy
: ActiveRecordValidationBase
67 private ProductLazy product
;
73 public CategoryLazy(String name
)
92 [BelongsTo("product_id")]
93 public ProductLazy Product
95 get { return product; }
96 set { product = value; }