Fixing an issue with output parameters that are of type IntPtr
[castle.git] / ActiveRecord / Castle.ActiveRecord / Framework / Internal / Model / HasManyToAnyModel.cs
blobc5e70d34ff6a4ebbc14beef0fac5bd95ad6eb442
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.Framework.Internal
17 using System;
18 using System.Collections.Generic;
19 using System.Reflection;
21 using Castle.ActiveRecord;
23 /// <summary>
24 /// This model represent a &lt;many-to-any/&gt; polymorphic association
25 /// </summary>
26 [Serializable]
27 public class HasManyToAnyModel : IVisitable
29 private readonly PropertyInfo prop;
30 private readonly HasManyToAnyAttribute hasManyToAnyAtt;
31 private IList<Any.MetaValueAttribute> metaValues;
32 /// <summary>
33 /// Initializes a new instance of the <see cref="HasManyToAnyModel"/> class.
34 /// </summary>
35 /// <param name="prop">The prop.</param>
36 /// <param name="hasManyToAnyAtt">The has many to any att.</param>
37 public HasManyToAnyModel(PropertyInfo prop, HasManyToAnyAttribute hasManyToAnyAtt)
39 this.prop = prop;
40 this.hasManyToAnyAtt = hasManyToAnyAtt;
41 metaValues = new List<Any.MetaValueAttribute>();
44 /// <summary>
45 /// Gets the property.
46 /// </summary>
47 /// <value>The property.</value>
48 public PropertyInfo Property
50 get { return prop; }
53 /// <summary>
54 /// Gets the has many to any attribute
55 /// </summary>
56 /// <value>The has many to any att.</value>
57 public HasManyToAnyAttribute HasManyToAnyAtt
59 get { return hasManyToAnyAtt; }
62 /// <summary>
63 /// Gets the configuration.
64 /// </summary>
65 /// <value>The configuration.</value>
66 public Config Configuration
68 get { return new Config(this); }
71 /// <summary>
72 /// Gets or sets the meta values.
73 /// </summary>
74 /// <value>The meta values.</value>
75 public IList<Any.MetaValueAttribute> MetaValues
77 get { return metaValues; }
78 set { metaValues = value; }
81 #region IVisitable Members
83 /// <summary>
84 /// Accepts the specified visitor and call the relevant IVisitor.Visit***() method
85 /// </summary>
86 /// <param name="visitor">The visitor.</param>
87 public void Accept(IVisitor visitor)
89 visitor.VisitHasManyToAny(this);
92 #endregion
94 /// <summary>
95 /// I need this class to pass special configuration for the many-to-any
96 /// </summary>
97 public class Config : IVisitable
99 HasManyToAnyModel parent;
101 /// <summary>
102 /// Gets or sets the parent model
103 /// </summary>
104 /// <value>The parent.</value>
105 public HasManyToAnyModel Parent
107 get { return parent; }
108 set { parent = value; }
111 /// <summary>
112 /// Initializes a new instance of the <see cref="Config"/> class.
113 /// </summary>
114 /// <param name="parent">The parent.</param>
115 internal Config(HasManyToAnyModel parent)
117 this.parent = parent;
120 #region IVisitable Members
122 /// <summary>
123 /// Accepts the specified visitor and call the relevant IVisitor.Visit***() method
124 /// </summary>
125 /// <param name="visitor">The visitor.</param>
126 public void Accept(IVisitor visitor)
128 visitor.VisitHasManyToAnyConfig(this);
131 #endregion