Class FieldInfoCollection
The FieldInfoCollection class
Inherited Members
Namespace: SuperOffice.Data.SQL
Assembly: SoDataBase.dll
Syntax
public class FieldInfoCollection : IEnumerable<FieldInfo>, IEnumerable
Constructors
FieldInfoCollection()
The FieldInfoCollection class
Declaration
public FieldInfoCollection()
Properties
this[int]
Returns the FieldInfo on a specific index.
Declaration
public FieldInfo this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index |
Property Value
Type | Description |
---|---|
FieldInfo |
Methods
Add(FieldInfo)
Adds values to the collection based on the in-parameter.
Declaration
public int Add(FieldInfo fieldInfo)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo |
Returns
Type | Description |
---|---|
int |
Add(FieldInfoCollection)
Adds values to the collection based on the in-parameter.
Declaration
public void Add(FieldInfoCollection fieldInfos)
Parameters
Type | Name | Description |
---|---|---|
FieldInfoCollection | fieldInfos |
Add(params FieldInfo[])
Adds values to the collection based on the in-parameter.
Declaration
public void Add(params FieldInfo[] fieldInfos)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo[] | fieldInfos |
Contains(FieldInfo)
Contains checks the FieldInfo collection for a specific FieldInfo.
Declaration
public bool Contains(FieldInfo field)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | field | The FieldInfo we want to know if exists or not. |
Returns
Type | Description |
---|---|
bool | Returns true if the FieldInfo exists, false if not. |
FromFieldInfoArray(FieldInfo[])
Convert an array into a collection explicitly.
Declaration
public static FieldInfoCollection FromFieldInfoArray(FieldInfo[] fieldInfos)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo[] | fieldInfos | Array |
Returns
Type | Description |
---|---|
FieldInfoCollection | A new collection containing the fields |
GetEnumerator()
Returns an enumerator to the collection.
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |
GetIndexOfField(FieldInfo)
Get the index of a field.
Declaration
public int GetIndexOfField(FieldInfo fieldInfo)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo | The field info. |
Returns
Type | Description |
---|---|
int | 0 based index of the field. -1 is returned if the field is not found. |
Remarks
Tries to resolve the field by using the following strategies in this order:
- Same instance of table and field.
- Same table and field name or full field number.
GetNumberOfItems()
Returns number of items in the collection.
Declaration
public int GetNumberOfItems()
Returns
Type | Description |
---|---|
int |
GetPrimaryKeyInFieldInfoCollection(FieldInfoCollection)
If there is a FieldInfo in the collection that is a primary key, this function will find and return it.
Declaration
public FieldInfo GetPrimaryKeyInFieldInfoCollection(FieldInfoCollection fields)
Parameters
Type | Name | Description |
---|---|---|
FieldInfoCollection | fields | The FieldInfo-collection containing all necessary fields for the sql-statement. |
Returns
Type | Description |
---|---|
FieldInfo | The primary-key as FieldInfo |
PrimaryKeyExist()
This function will check if the FieldInfoCollection contains a primaryKey. If it does, it will return true, if not, false.
Declaration
public bool PrimaryKeyExist()
Returns
Type | Description |
---|---|
bool | True/False |
ValidateFieldInfoCollection(bool)
CheckFieldInfoCollectionReady will validate the in-coming FieldInfoCollection. The function will check the following: The collection IS NOT null, The collection contains at least one FieldInfo, The collection contains a Primary-key. If the checkPrimaryKeyExists is true, the existence of a primary-key will be checked. Needed when dealing with for example a insert-statement. The ArgumentParameterCollection need the primary-key to be able to insert the data in a unique row in the database.
Declaration
public bool ValidateFieldInfoCollection(bool checkPrimaryKeyExists)
Parameters
Type | Name | Description |
---|---|---|
bool | checkPrimaryKeyExists | True, we check the collection for the existence of a primary-key. False, we skip this test. |
Returns
Type | Description |
---|---|
bool | True if the collection is validated correct. Will throw an SoIllegalOperationException if not. |
Operators
implicit operator FieldInfoCollection(FieldInfo[])
Convert an array into a collection
Declaration
public static implicit operator FieldInfoCollection(FieldInfo[] fieldInfos)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo[] | fieldInfos | Array |
Returns
Type | Description |
---|---|
FieldInfoCollection | A new collection containing the fields |