/*
* Namespace Summary
* Copyright (C) 2005+ Bogdan Damian Constantin
* E-Mail: damianbcpetro@gmail.com
* WEB: http://www.sourceforge.net/projects/dataholder
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License 2.1 or later, as
* published by the Free Software Foundation. See the included License.txt
* or http://www.gnu.org/copyleft/lesser.html for details.
*
*/
using System;
using System.Collections;
using System.ComponentModel;
namespace DataHolder.DataPersistence.DBAProvider.Properties{
/// <summary>
/// It's a collection that keep all tthe persistence mappings
/// between Generic Data Properties and the DataTableFileds
/// </summary>
public class PersistenceFieldCollection:IList, IDisposable
{
protected ArrayList innerList = new ArrayList(1);
#region IList Members
public bool IsReadOnly
{
get
{
return true;
}
}
object IList.this[int index]
{
get
{
return (APersistenceField)innerList[index];
}
set
{
innerList[index] = value;
}
}
public APersistenceField this[int index]
{
get
{
return (APersistenceField)innerList[index];
}
set
{
innerList[index] = value;
}
}
public void RemoveAt(int index)
{
innerList.RemoveAt(index);
}
public void Insert(int index, object value)
{
innerList.Insert(index, value);
}
public void Remove(object value)
{
innerList.Remove(value);
}
public bool Contains(object value)
{
return innerList.Contains(value);
}
public void Clear()
{
innerList.Clear();
}
public int IndexOf(object value)
{
return innerList.IndexOf(value);
}
public int Add(object value)
{
return innerList.Add(value);
}
public bool IsFixedSize
{
get{return false;}
}
#endregion
#region ICollection Members
public bool IsSynchronized
{
get
{
return false;
}
}
public int Count
{
get
{
return innerList.Count;
}
}
public void CopyTo(Array array, int index)
{
innerList.CopyTo(array, index);
}
public object SyncRoot
{
get
{
return innerList.SyncRoot;
}
}
#endregion
#region IEnumerable Members
public IEnumerator GetEnumerator()
{
return innerList.GetEnumerator();
}
#endregion
#region Collumn
public int IndexOfRecordSetColumn(string p_RecordSetName)
{
APersistenceField tmpp = null;
for(int i = 0; i < this.Count; i++)
{
tmpp = this[i];
if(tmpp.RecordSetName.Equals(p_RecordSetName))
return i;
}
return -1;
}
public int IndexOfPropertyColumn(string p_PropertyName)
{
APersistenceField tmpp = null;
for(int i = 0; i < this.Count; i++)
{
tmpp = this[i];
if(tmpp.PropertyName.Equals(p_PropertyName))
return i;
}
return -1;
}
public APersistenceField GetByPropertyName(string p_PropertyName)
{
APersistenceField tmpp = null;
for(int i = 0; i < this.Count; i++)
{
tmpp = this[i];
if(tmpp.PropertyName.Equals(p_PropertyName))
return tmpp;
}
return null;
}
#endregion
#region IDisposable Members
public void Dispose()
{
if(innerList != null)
innerList.Clear();
innerList = null;
}
#endregion
}
}
|