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 /// Model to represent a HasMany ( one to many ) association
24 public class HasManyModel
: IVisitable
26 private readonly PropertyInfo propInfo
;
27 private readonly HasManyAttribute hasManyAtt
;
28 private DependentObjectModel dependentObjectModel
;
31 /// Initializes a new instance of the <see cref="HasManyModel"/> class.
33 /// <param name="propInfo">The prop info.</param>
34 /// <param name="hasManyAtt">The has many att.</param>
35 public HasManyModel(PropertyInfo propInfo
, HasManyAttribute hasManyAtt
)
37 this.hasManyAtt
= hasManyAtt
;
38 this.propInfo
= propInfo
;
42 /// Gets the property.
44 /// <value>The property.</value>
45 public PropertyInfo Property
47 get { return propInfo; }
51 /// Gets the has many attribute
53 /// <value>The has many att.</value>
54 public HasManyAttribute HasManyAtt
56 get { return hasManyAtt; }
60 /// Gets/Sets the the dependent object model
62 /// <value>The dependent object model.</value>
63 public DependentObjectModel DependentObjectModel
65 get { return dependentObjectModel; }
66 set { dependentObjectModel = value; }
69 #region IVisitable Members
72 /// Accepts the specified visitor and call the relevant IVisitor.Visit***() method
74 /// <param name="visitor">The visitor.</param>
75 public void Accept(IVisitor visitor
)
77 visitor
.VisitHasMany(this);