Fixing an issue with output parameters that are of type IntPtr
[castle.git] / ActiveRecord / Castle.ActiveRecord / Framework / Internal / ActiveRecordModelCollection.cs
blob851e25a5b87ff86058938c94347a077a99bd5d68
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;
20 /// <summary>
21 /// Map System.Type to their ActiveRecordModel
22 /// </summary>
23 public class ActiveRecordModelCollection : DictionaryBase, IEnumerable
25 /// <summary>
26 /// Adds the specified model.
27 /// </summary>
28 /// <param name="model">The model.</param>
29 public void Add(ActiveRecordModel model)
31 Dictionary.Add(model.Type, model);
34 /// <summary>
35 /// Determines whether the collection contains the specified type.
36 /// </summary>
37 /// <param name="type">The type.</param>
38 /// <returns>
39 /// <c>true</c> if the collection contains the specified type; otherwise, <c>false</c>.
40 /// </returns>
41 public bool Contains(Type type)
43 return Dictionary.Contains(type);
46 /// <summary>
47 /// Gets the <see cref="Castle.ActiveRecord.Framework.Internal.ActiveRecordModel"/> with the specified type.
48 /// </summary>
49 /// <value></value>
50 public ActiveRecordModel this[Type type]
52 get { return Dictionary[type] as ActiveRecordModel; }
55 #region IEnumerable Members
57 /// <summary>
58 /// Returns an enumerator that iterates through a collection.
59 /// </summary>
60 /// <returns>
61 /// An <see cref="T:System.Collections.IEnumerator"></see> object that can be used to iterate through the collection.
62 /// </returns>
63 public new IEnumerator GetEnumerator()
65 return Dictionary.Values.GetEnumerator();
68 #endregion