using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.PPC.Shared.SQL
{
///
/// Represents a columns collection.
///
///
public class RemoteSqlColumnCollection : Collection
{
private Dictionary _dictionary;
///
/// Initializes a new instance of the class.
///
public RemoteSqlColumnCollection()
{
_dictionary = new Dictionary();
}
///
/// Inserts an element into the at the specified index.
///
/// The zero-based index at which should be inserted.
/// The object to insert. The value can be null for reference types.
protected override void InsertItem(int index, RemoteSqlColumn item)
{
item.Index = Count;
_dictionary.Add(item.Name, item);
base.InsertItem(index, item);
}
///
/// Removes the element at the specified index of the .
///
/// The zero-based index of the element to remove.
///
protected override void RemoveItem(int index)
{
throw new NotSupportedException();
}
///
/// Removes all elements from the .
///
protected override void ClearItems()
{
_dictionary.Clear();
base.ClearItems();
}
///
/// Replaces the element at the specified index.
///
/// The zero-based index of the element to replace.
/// The new value for the element at the specified index. The value can be null for reference types.
///
protected override void SetItem(int index, RemoteSqlColumn item)
{
throw new NotSupportedException();
}
///
/// Gets the column index by column name.
///
/// Column name.
///
public int GetIndexOf(String columnName)
{
return _dictionary[columnName].Index;
}
}
}