aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs
blob: 5358e047b03bfec67fdb93c6a6b03f71e4a33480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
{
    public class RemoteSqlColumnCollection : Collection<RemoteSqlColumn>
    {
        private Dictionary<String, RemoteSqlColumn> _dictionary;

        public RemoteSqlColumnCollection()
        {
            _dictionary = new Dictionary<string, RemoteSqlColumn>();
        }

        protected override void InsertItem(int index, RemoteSqlColumn item)
        {
            item.Index = Count;
            _dictionary.Add(item.Name, item);
            base.InsertItem(index, item);
        }

        protected override void RemoveItem(int index)
        {
            throw new NotSupportedException();
        }

        protected override void ClearItems()
        {
            _dictionary.Clear();
            base.ClearItems();
        }

        protected override void SetItem(int index, RemoteSqlColumn item)
        {
            throw new NotSupportedException();
        }

        public int GetIndexOf(String columnName)
        {
            return _dictionary[columnName].Index;
        }
    }
}