#region Copyright
// Advanced.Data.Provider.AdpParameterCollection
//
// Copyright (C) 2004 Astrein Engenharia de Manuteno S/A
// Copyright (C) 2004 Everaldo Canuto <everaldo_canuto@yahoo.com.br>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#endregion
using System;
using System.Data;
namespace Advanced.Data.Provider{
/// <summary>
/// Represents a collection of parameters relevant to a <see cref='AdpCommand'/> as well as their respective mappings to columns in a <see cref='DataSet'/>.
/// </summary>
public class AdpParameterCollection : IDataParameterCollection
{
#region Fields
/// <summary>
/// Represents this instance of the <see cref='AdpParameterCollection'/> object created.
/// </summary>
public IDataParameterCollection _Collection;
#endregion
#region Public properties
/// <summary>
/// Gets the number of <see cref='AdpParameter'/> objects in the collection.
/// </summary>
public int Count
{
get
{
return _Collection.Count;
}
}
/// <summary>
/// Gets a value indicating whether the collection has a fixed size.
/// </summary>
public bool IsFixedSize
{
get
{
return _Collection.IsFixedSize;
}
}
/// <summary>
/// Gets a value indicating whether the <see cref='AdpParameterCollection'/> is read-only.
/// </summary>
public bool IsReadOnly
{
get
{
return _Collection.IsReadOnly;
}
}
/// <summary>
/// Returns a value that indicates whether access to the collection is synchronized (thread safe).
/// </summary>
public bool IsSynchronized
{
get
{
return _Collection.IsSynchronized;
}
}
/// <summary>
/// Returns the object that can be used to synchronize access to the collection.
/// </summary>
public object SyncRoot
{
get
{
return _Collection.SyncRoot;
}
}
/// <summary>
/// Gets the <see cref='AdpParameter'/> with the specified name.
/// </summary>
/// <param parameterName="name">The name of the parameter to retrieve.</param>
public object this[string parameterName]
{
get
{
return _Collection[parameterName];
}
set
{
_Collection[parameterName]=value;
}
}
#endregion
#region Public methods
/// <summary>
/// This property is the indexer for the <see cref='AdpParameterCollection'/> class.
/// </summary>
object System.Collections.IList.this[int index]
{
get
{
return _Collection[index];
}
set
{
_Collection[index]=value;
}
}
/// <summary>
/// Removes the specified <see cref='AdpParameter'/> from the collection.
/// </summary>
/// <param name="index">The zero-based index of the <see cref='AdpParameter'/>.</param>
void System.Collections.IList.RemoveAt(int index)
{
_Collection.RemoveAt(index);
}
/// <summary>
/// Removes the specified <see cref='AdpParameter'/> from the collection.
/// </summary>
/// <param name="parameterName">The name of the <see cref='AdpParameter'/> to remove.</param>
public void RemoveAt(string parameterName)
{
_Collection.RemoveAt(parameterName);
}
/// <summary>
/// Determines whether the collection contains a specific value.
/// </summary>
/// <param name="value">The name of the object to find.</param>
/// <returns>true if the collection contains the parameter; otherwise, false.</returns>
bool System.Collections.IList.Contains(object value)
{
return _Collection.Contains(value);
}
/// <summary>
/// Gets a value indicating whether a <see cref='AdpParameter'/> exists in the collection.
/// </summary>
/// <param name="parameterName">The name of the <see cref='AdpParameter'/> to find.</param>
/// <returns>true if the collection contains the parameter; otherwise, false.</returns>
public bool Contains(string parameterName)
{
return _Collection.Contains(parameterName);
}
/// <summary>
/// Gets the location of a <see cref='AdpParameter'/> in the collection.
/// </summary>
/// <param name="value">The name of the parameter to find.</param>
/// <returns>The zero-based location of the <see cref='IDataParameter'/> within the collection.</returns>
int System.Collections.IList.IndexOf(object value)
{
return _Collection.IndexOf(value);
}
/// <summary>
/// Gets the location of a <see cref='AdpParameter'/> in the collection.
/// </summary>
/// <param name="parameterName">The name of the <see cref='AdpParameter'/> to find.</param>
/// <returns>The zero-based location of the <see cref='AdpParameter'/> within the collection.</returns>
public int IndexOf(string parameterName)
{
return _Collection.IndexOf(parameterName);
}
/// <summary>
/// Inserts a <see cref='AdpParameter'/> into the collection at the specified index.
/// </summary>
/// <param name="index">The zero-based index where the <see cref='AdpParameter'/> is to be inserted within the collection.</param>
/// <param name="value">The <see cref='AdpParameter'/> to add to the collection.</param>
public void Insert(int index, object value)
{
_Collection.Insert(index,((AdpParameter)value).dataParameter);
}
/// <summary>
/// Removes the specified <see cref='AdpParameter'/> from the collection.
/// </summary>
/// <param name="value">The <see cref='AdpParameter'/> to remove from the collection.</param>
public void Remove(object value)
{
_Collection.Remove(((AdpParameter)value).dataParameter);
}
/// <summary>
/// Removes all items from the collection.
/// </summary>
public void Clear()
{
_Collection.Clear();
}
/// <summary>
/// Adds a AdpParameter to the <see cref='AdpParameterCollection'/>.
/// </summary>
/// <param name="value">The <see cref='AdpParameter'/> to add to the collection.</param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(object value)
{
return _Collection.Add(((AdpParameter)value).dataParameter);
}
/// <summary>
/// Copies <see cref='AdpParameter'/> objects from the <see cref='AdpParameterCollection'/> to the specified array.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination of the elements copied from <see cref='AdpParameterCollection'/>. The Array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in array at which copying begins.</param>
public void CopyTo(Array array, int index)
{
_Collection.CopyTo(array,index);
}
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>An <see cref='System.Collections.IEnumerator'/> that can be used to iterate through the collection.</returns>
public System.Collections.IEnumerator GetEnumerator()
{
return _Collection.GetEnumerator();
}
#endregion
}
}
|