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
.Framework
.Internal
18 using System
.Reflection
;
21 /// This model is used to represent a nested value type (<component/> - in NHibernate talk).
24 public class NestedModel
: IVisitable
26 private readonly PropertyInfo propInfo
;
27 private readonly NestedAttribute nestedAtt
;
28 private readonly ActiveRecordModel nestedModel
;
31 /// Initializes a new instance of the <see cref="NestedModel"/> class.
33 /// <param name="propInfo">The prop info.</param>
34 /// <param name="nestedAtt">The nested att.</param>
35 /// <param name="nestedModel">The nested model.</param>
36 public NestedModel( PropertyInfo propInfo
, NestedAttribute nestedAtt
, ActiveRecordModel nestedModel
)
38 this.nestedAtt
= nestedAtt
;
39 this.nestedModel
= nestedModel
;
40 this.propInfo
= propInfo
;
46 /// <value>The model.</value>
47 public ActiveRecordModel Model
49 get { return nestedModel; }
53 /// Gets the property.
55 /// <value>The property.</value>
56 public PropertyInfo Property
58 get { return propInfo; }
62 /// Gets the nested attribute
64 /// <value>The nested att.</value>
65 public NestedAttribute NestedAtt
67 get { return nestedAtt; }
70 #region IVisitable Members
73 /// Accepts the specified visitor and call the relevant IVisitor.Visit***() method
75 /// <param name="visitor">The visitor.</param>
76 public void Accept(IVisitor visitor
)
78 visitor
.VisitNested(this);