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
;
22 /// Model to HasAndBelongsToMany, which is used to model a many to many assoication.
25 public class HasAndBelongsToManyModel
: IVisitable
27 private readonly PropertyInfo propInfo
;
28 private readonly HasAndBelongsToManyAttribute hasManyAtt
;
29 private CollectionIDModel collectionID
;
32 /// Initializes a new instance of the <see cref="HasAndBelongsToManyModel"/> class.
34 /// <param name="propInfo">The prop info.</param>
35 /// <param name="hasManyAtt">The has many att.</param>
36 public HasAndBelongsToManyModel( PropertyInfo propInfo
, HasAndBelongsToManyAttribute hasManyAtt
)
38 this.hasManyAtt
= hasManyAtt
;
39 this.propInfo
= propInfo
;
43 /// Gets the property.
45 /// <value>The property.</value>
46 public PropertyInfo Property
48 get { return propInfo; }
52 /// Gets the has many attribute
54 /// <value>The has many att.</value>
55 public HasAndBelongsToManyAttribute HasManyAtt
57 get { return hasManyAtt; }
61 /// Gets or sets the collection ID.
63 /// <value>The collection ID.</value>
64 public CollectionIDModel CollectionID
66 get { return collectionID; }
67 set { collectionID = value; }
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
.VisitHasAndBelongsToMany(this);