Пример #1
0
        public void DataSetSource_table_methods_works()
        {
            DataSet       ds  = GetDataSet();
            DataSetSource dss = new DataSetSource(ds);

            int[] tables = dss.GetTables().ToArray();
            Assert.AreEqual(1, tables.Length);
            Assert.AreEqual("testtable", dss.GetTableName(tables[0]));
            Assert.AreEqual(tables[0], dss.GetTableIndex("testtable"));
        }
Пример #2
0
        public int GetTableIndex(string tableName)
        {
            int index = _source.GetTableIndex(tableName);

            if (index < 0)
            {
                string[] parts = tableName.Split(NAME_QUERY_SEPARATOR, 2, StringSplitOptions.None);
                string   name, query;
                if (parts.Length > 1)
                {
                    name  = parts[0];
                    query = parts[1];
                }
                else
                {
                    name  = tableName;
                    query = tableName;
                }
                _reader.AddQuery(name, query);
                _source = new DataSetSource(_reader.ToDataSet());
                index   = _source.GetTableIndex(name);
            }
            return(index);
        }