Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / ActiveRecord / Castle.ActiveRecord / Attributes / NestedParentReferenceAttribute.cs
blob78cf1f1876861f5af59648120a2d530649a76b01
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
17 using System;
19 /// <summary>
20 /// Maps a property of a child object to its parent object.
21 /// </summary>
22 /// <example>
23 /// The following code illustrates the use of a
24 /// parent <c>Company</c> class
25 /// <code>
26 /// public class PostalAddress
27 /// {
28 /// private Company _company;
29 /// private String _address;
30 /// private String _city;
31 /// private String _state;
32 /// private String _zipcode;
33 ///
34 /// [Parent]
35 /// public Company Parent
36 /// {
37 /// get { return _company; }
38 /// set { _company = value; }
39 /// }
40 ///
41 /// [Property]
42 /// public String Address
43 /// {
44 /// get { return _address; }
45 /// set { _address = value; }
46 /// }
47 ///
48 /// [Property]
49 /// public String City
50 /// {
51 /// get { return _city; }
52 /// set { _city = value;}
53 /// }
54 ///
55 /// [Property]
56 /// public String State
57 /// {
58 /// get { return _state; }
59 /// set { _state = value; }
60 /// }
61 ///
62 /// [Property]
63 /// public String ZipCode
64 /// {
65 /// get { return _zipcode; }
66 /// set { _zipcode = value; }
67 /// }
68 /// }
69 ///
70 /// [ActiveRecord("Companies")]
71 /// public class Company : ActiveRecordBase
72 /// {
73 /// private int id;
74 /// private PostalAddress _address;
75 ///
76 /// public Company()
77 /// {
78 /// }
79 ///
80 /// public Company(string name)
81 /// {
82 /// this.name = name;
83 /// }
84 ///
85 /// [PrimaryKey]
86 /// public int Id
87 /// {
88 /// get { return id; }
89 /// set { id = value; }
90 /// }
91 ///
92 /// [Nested]
93 /// public PostalAddress Address
94 /// {
95 /// get { return _address; }
96 /// set { _address = value; }
97 /// }
98 /// }
99 /// </code>
100 /// </example>
101 [AttributeUsage(AttributeTargets.Property, AllowMultiple=false), Serializable]
102 public class NestedParentReferenceAttribute : Attribute
104 /// <summary>
105 /// Informs ActiveRecord that the marked property is the parent of a nested element
106 /// </summary>
107 public NestedParentReferenceAttribute() {}