Applied patch from Jan Limpens 'ReflectionBasedDictionaryAdapter needs to check if...
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / CompositeNested / CompositeNestedParent.cs
blob79ae3b42596c814c294b0b504333a989efa42eb9
1 // Copyright 2004-2008 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 Castle.ActiveRecord.Tests.Model.CompositeNested
17 using System;
18 using System.Collections;
20 [ActiveRecord]
21 public class CompositeNestedParent : ActiveRecordBase
23 private int id;
24 private IList dependents;
26 [PrimaryKey(PrimaryKeyType.Native)]
27 public int Id
29 get { return id; }
30 set { id = value; }
33 [HasMany(typeof(Dependent), "Parent_Id", "CompositeNestedParent_Dependent" , DependentObjects = true)]
34 public IList Dependents
36 get { return dependents; }
37 set { dependents = value; }
40 public static void DeleteAll()
42 DeleteAll(typeof(CompositeNestedParent));
45 public static CompositeNestedParent[] FindAll()
47 return (CompositeNestedParent[])FindAll(typeof(CompositeNestedParent));
50 public static CompositeNestedParent Find(int id)
52 return (CompositeNestedParent)FindByPrimaryKey(typeof(CompositeNestedParent), id);
57 public class Dependent
59 private DateTime dateProp;
60 private NestedDependent nestedDependentProp;
62 [Nested]
63 public NestedDependent NestedDependentProp
65 get { return nestedDependentProp; }
66 set { nestedDependentProp = value; }
69 [Property]
70 public DateTime DateProp
72 get { return dateProp; }
73 set { dateProp = value; }
77 public class NestedDependent
79 private int intProp;
80 private InnerNestedDependant innerNestedDependantProp;
82 [Property]
83 public int IntProp
85 get { return intProp; }
86 set { intProp = value; }
89 [Nested]
90 public InnerNestedDependant InnerNestedDependantProp
92 get { return innerNestedDependantProp;}
93 set
95 innerNestedDependantProp = value;
100 public class InnerNestedDependant
102 private string stringProp;
104 [Property]
105 public string StringProp
107 get { return stringProp; }
108 set { stringProp = value; }