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
20 /// Maps a property of a child object to its parent object.
23 /// The following code illustrates the use of a
24 /// parent <c>Company</c> class
26 /// public class PostalAddress
28 /// private Company _company;
29 /// private String _address;
30 /// private String _city;
31 /// private String _state;
32 /// private String _zipcode;
35 /// public Company Parent
37 /// get { return _company; }
38 /// set { _company = value; }
42 /// public String Address
44 /// get { return _address; }
45 /// set { _address = value; }
49 /// public String City
51 /// get { return _city; }
52 /// set { _city = value;}
56 /// public String State
58 /// get { return _state; }
59 /// set { _state = value; }
63 /// public String ZipCode
65 /// get { return _zipcode; }
66 /// set { _zipcode = value; }
70 /// [ActiveRecord("Companies")]
71 /// public class Company : ActiveRecordBase
74 /// private PostalAddress _address;
80 /// public Company(string name)
88 /// get { return id; }
89 /// set { id = value; }
93 /// public PostalAddress Address
95 /// get { return _address; }
96 /// set { _address = value; }
101 [AttributeUsage(AttributeTargets
.Property
, AllowMultiple
=false), Serializable
]
102 public class NestedParentReferenceAttribute
: Attribute
105 /// Informs ActiveRecord that the marked property is the parent of a nested element
107 public NestedParentReferenceAttribute() {}