Class AdbParameterCollection
Supports creating, adding and inspecting the parameters of an AdbCommand database command.
Using the Add* methods on this class is the main way to create parameters, which can
then be further modified by calling methods and modifying properties on the returned
AdbParameter instance.
In particular, do set the parameter database type explicitly wherever possible, since relying on the provider to guess the database type can lead to conversion issues, and can in some cases reduce performance. See AdbParameter for details.
Note: parameter names in the collection must at a minimum be (case sensitive) unique. Some providers have additional requirements, e.g. case insensitive unique.
Also see the Stored Procedure Example, which demonstrates how to use this class.
Namespace: actionETL.Adb
Assembly: actionETL.dll
Syntax
public sealed class AdbParameterCollection : IList, ICollection, IEnumerable<AdbParameter>, IEnumerable
Properties
Count
Gets the number of parameters in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
IsFixedSize
Gets a value indicating whether the collection has a fixed size.
Declaration
public bool IsFixedSize { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Item[Int32]
Gets or sets the AdbParameter at the specified index.
Declaration
public AdbParameter this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The index. |
Property Value
| Type | Description |
|---|---|
| AdbParameter | The AdbParameter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| IndexOutOfRangeException |
|
Item[String]
Gets or sets the AdbParameter with the specified parameter name.
Declaration
public AdbParameter this[string parameterName] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | Name of the parameter, including any named parameter prefix or suffix (e.g.
|
Property Value
| Type | Description |
|---|---|
| AdbParameter | The AdbParameter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
SyncRoot
Gets an object that can be used to synchronize access to the collection.
Declaration
public object SyncRoot { get; }
Property Value
| Type | Description |
|---|---|
| Object |
Methods
Add(AdbParameter)
Adds the specified Adb database parameter to the end of the collection.
Declaration
public int Add(AdbParameter adbParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| AdbParameter | adbParameter | An Adb database parameter. |
Returns
| Type | Description |
|---|---|
| Int32 | The index of the parameter in the collection. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Add(String)
Creates and adds a parameter to the end of the collection, with the default input direction, without any specified value.
Declaration
public AdbParameter Add(string parameterName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | Name of the parameter, including any named parameter prefix or suffix (e.g.
|
Returns
| Type | Description |
|---|---|
| AdbParameter | The created parameter, allowing making further changes to the parameter by chaining method calls. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | An element (i.e. parameter) with the same key (parameter name) already exists in the collection. |
| ArgumentNullException |
|
Add(String, ParameterDirection)
Creates and adds a parameter to the end of the collection, without any specified value.
Declaration
public AdbParameter Add(string parameterName, ParameterDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | Name of the parameter, including any named parameter prefix or suffix (e.g.
|
| ParameterDirection | direction | The direction. |
Returns
| Type | Description |
|---|---|
| AdbParameter | The created parameter, allowing making further changes to the parameter by chaining method calls, or to save the parameter reference in a variable for later use. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | An element (i.e. parameter) with the same key (parameter name) already exists in the collection. |
| ArgumentNullException |
|
Add(String, String)
Creates and adds a parameter to the end of the collection, with the default input direction, without any specified value.
Declaration
public AdbParameter Add(string parameterName, string sourceColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | Name of the parameter, including any named parameter prefix or suffix (e.g.
|
| String | sourceColumn | The source column name, see SourceColumn.
Cannot be |
Returns
| Type | Description |
|---|---|
| AdbParameter | The created parameter, allowing making further changes to the parameter by chaining method calls, or to save the parameter reference in a variable for later use. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | An element (i.e. parameter) with the same key (parameter name) already exists in the collection. |
| ArgumentNullException |
|
Add(String, String, ParameterDirection)
Creates and adds a parameter to the end of the collection, without any specified value.
Declaration
public AdbParameter Add(string parameterName, string sourceColumn, ParameterDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | Name of the parameter, including any named parameter prefix or suffix (e.g.
|
| String | sourceColumn | The source column name, see SourceColumn.
Cannot be |
| ParameterDirection | direction | The direction. |
Returns
| Type | Description |
|---|---|
| AdbParameter | The created parameter, allowing making further changes to the parameter by chaining method calls, or to save the parameter reference in a variable for later use. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | An element (i.e. parameter) with the same key (parameter name) already exists in the collection. |
| ArgumentNullException |
|
AddRange(IEnumerable<AdbParameter>)
Adds the specified Adb database parameters to the end of the collection.
Declaration
public void AddRange(IEnumerable<AdbParameter> adbParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<AdbParameter> | adbParameters | The Adb database parameters to add. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Clear()
Removes all parameters from the collection.
Declaration
public void Clear()
Contains(AdbParameter)
Gets a value indicating whether a particular parameter instance is in the collection.
Declaration
public bool Contains(AdbParameter adbParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| AdbParameter | adbParameter | The Adb database parameter. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Contains(String)
Gets a value indicating whether a parameter in the collection has the specified name.
Note that the comparison is case sensitive, and includes any name prefix (such as @ or :)
that was specified when creating the parameter.
Declaration
public bool Contains(string parameterName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | The name of the parameter. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
CopyTo(AdbParameter[], Int32)
Copies the elements of the collection to an array, starting at a particular index.
Declaration
public void CopyTo(AdbParameter[] array, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| AdbParameter[] | array | The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing. |
| Int32 | index | The zero-based index in |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
| ArgumentException | The number of elements in the source list
is greater than the available space from |
GetEnumerator()
Returns a generic enumerator that iterates through the parameter collection.
Declaration
public IEnumerator<AdbParameter> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<AdbParameter> |
IndexOf(AdbParameter)
Returns the index of the specified AdbParameter instance.
Declaration
public int IndexOf(AdbParameter adbParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| AdbParameter | adbParameter | The Adb database parameter. |
Returns
| Type | Description |
|---|---|
| Int32 | The zero-based index of the parameter, or |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
IndexOf(String)
Returns the index of the specified AdbParameter name.
Note that the comparison is case sensitive, and includes any name prefix (such as
@ or :) that was specified when creating the parameter.
Declaration
public int IndexOf(string parameterName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | The name of the parameter. |
Returns
| Type | Description |
|---|---|
| Int32 | The zero-based index of the parameter, or |
Insert(Int32, AdbParameter)
Inserts an Adb parameter into the collection.
Note that all existing parameters at index or later in the collection will have their index location
increased by one.
Declaration
public void Insert(int index, AdbParameter adbParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The zero-based position at which to insert the parameter. Insertions at the end are legal. |
| AdbParameter | adbParameter | The Adb database parameter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
Remove(AdbParameter)
Removes the specified Adb parameter from the collection, if present.
Returns true if the parameter was found and removed; false if it
was not found.
Declaration
public bool Remove(AdbParameter adbParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| AdbParameter | adbParameter | The Adb database parameter to remove. |
Returns
| Type | Description |
|---|---|
| Boolean |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
RemoveAt(Int32)
Removes the parameter at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The zero-based index of the parameter to remove. |
Exceptions
| Type | Condition |
|---|---|
| IndexOutOfRangeException |
|
RemoveAt(String)
Removes the specified Adb parameter from the collection.
Declaration
public void RemoveAt(string parameterName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | parameterName | Name of the parameter, including any named parameter prefix or suffix (e.g.
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
ToString()
Returns a String that represents this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
Explicit Interface Implementations
ICollection.CopyTo(Array, Int32)
Copies the elements of the collection to an array, starting at a particular index.
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | array | The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing. |
| Int32 | index | The zero-based index in |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The current Array does not have exactly one dimension. |
| ArgumentNullException |
|
| InvalidCastException | Value cannot be cast to the element type of the current Array. |
| IndexOutOfRangeException |
|
ICollection.IsSynchronized
Gets a value indicating whether access to the collection is synchronized.
Always false.
Declaration
bool ICollection.IsSynchronized { get; }
Returns
| Type | Description |
|---|---|
| Boolean |
IEnumerable.GetEnumerator()
Returns a non-generic enumerator that iterates through the parameter collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator |
IList.Add(Object)
Not supported. Use Add(AdbParameter) instead.
Declaration
int IList.Add(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value |
Returns
| Type | Description |
|---|---|
| Int32 |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException |
IList.Contains(Object)
Not supported. Use Contains(AdbParameter) instead.
Declaration
bool IList.Contains(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value |
Returns
| Type | Description |
|---|---|
| Boolean |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException |
IList.IndexOf(Object)
Returns the index of the specified AdbParameter instance.
Declaration
int IList.IndexOf(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value | The Adb database parameter. |
Returns
| Type | Description |
|---|---|
| Int32 | The zero-based index of the parameter, or |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
IList.Insert(Int32, Object)
Not supported. Use Insert(Int32, AdbParameter) instead.
Declaration
void IList.Insert(int index, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | |
| Object | value |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException |
IList.IsReadOnly
Gets a value indicating whether the collection is read-only.
Declaration
bool IList.IsReadOnly { get; }
Returns
| Type | Description |
|---|---|
| Boolean |
IList.Item[Int32]
Do not use. Use this[int] instead.
Declaration
object IList.this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
Returns
| Type | Description |
|---|---|
| Object |
IList.Remove(Object)
Removes the specified Adb parameter from the collection, if present.
Returns true if the parameter was found and removed; false if it
was not found.
Declaration
void IList.Remove(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value | The Adb database parameter to remove. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|