Fixing an issue with output parameters that are of type IntPtr
[castle.git] / ActiveRecord / Castle.ActiveRecord / Framework / Internal / ModelBuilderExtensionComposite.cs
blobd70c678bd1ecd42977a41c33e90501ca40756b7c
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 /// <summary>
22 /// Dispatches the extension invocations to the inner extension list.
23 /// </summary>
24 public sealed class ModelBuilderExtensionComposite : IModelBuilderExtension
26 private readonly IList<IModelBuilderExtension> extensions;
28 /// <summary>
29 /// Initializes a new instance of the <see cref="ModelBuilderExtensionComposite"/> class.
30 /// </summary>
31 /// <param name="extensions">The extensions.</param>
32 public ModelBuilderExtensionComposite(IList<IModelBuilderExtension> extensions)
34 this.extensions = extensions;
37 /// <summary>
38 /// Dispatches the call to the extensions.
39 /// </summary>
40 /// <param name="type">The type.</param>
41 /// <param name="model">The model.</param>
42 public void ProcessClass(Type type, ActiveRecordModel model)
44 foreach(IModelBuilderExtension extension in extensions)
46 extension.ProcessClass(type, model);
50 /// <summary>
51 /// Dispatches the call to the extensions.
52 /// </summary>
53 /// <param name="pi">The property info reflection object.</param>
54 /// <param name="model">The model.</param>
55 public void ProcessProperty(PropertyInfo pi, ActiveRecordModel model)
57 foreach(IModelBuilderExtension extension in extensions)
59 extension.ProcessProperty(pi, model);
63 /// <summary>
64 /// Dispatches the call to the extensions.
65 /// </summary>
66 /// <param name="fi">The field info reflection object.</param>
67 /// <param name="model">The model.</param>
68 public void ProcessField(FieldInfo fi, ActiveRecordModel model)
70 foreach(IModelBuilderExtension extension in extensions)
72 extension.ProcessField(fi, model);
76 /// <summary>
77 /// Dispatches the call to the extensions.
78 /// </summary>
79 /// <param name="pi">The property info reflection object.</param>
80 /// <param name="belongsToModel">The belongs to model.</param>
81 /// <param name="model">The model.</param>
82 public void ProcessBelongsTo(PropertyInfo pi, BelongsToModel belongsToModel, ActiveRecordModel model)
84 foreach(IModelBuilderExtension extension in extensions)
86 extension.ProcessBelongsTo(pi, belongsToModel, model);
90 /// <summary>
91 /// Dispatches the call to the extensions.
92 /// </summary>
93 /// <param name="pi">The property info reflection object.</param>
94 /// <param name="hasManyModel">The has many model.</param>
95 /// <param name="model">The model.</param>
96 public void ProcessHasMany(PropertyInfo pi, HasManyModel hasManyModel, ActiveRecordModel model)
98 foreach(IModelBuilderExtension extension in extensions)
100 extension.ProcessHasMany(pi, hasManyModel, model);
104 /// <summary>
105 /// Dispatches the call to the extensions.
106 /// </summary>
107 /// <param name="pi">The property info reflection object.</param>
108 /// <param name="hasManyModel">The has many model.</param>
109 /// <param name="model">The model.</param>
110 public void ProcessHasManyToAny(PropertyInfo pi, HasManyToAnyModel hasManyModel, ActiveRecordModel model)
112 foreach(IModelBuilderExtension extension in extensions)
114 extension.ProcessHasManyToAny(pi, hasManyModel, model);
118 /// <summary>
119 /// Dispatches the call to the extensions.
120 /// </summary>
121 /// <param name="pi">The property info reflection object.</param>
122 /// <param name="hasAndBelongManyModel">The has and belong many model.</param>
123 /// <param name="model">The model.</param>
124 public void ProcessHasAndBelongsToMany(PropertyInfo pi, HasAndBelongsToManyModel hasAndBelongManyModel,
125 ActiveRecordModel model)
127 foreach(IModelBuilderExtension extension in extensions)
129 extension.ProcessHasAndBelongsToMany(pi, hasAndBelongManyModel, model);