Ejemplo n.º 1
0
        private static IColumn CreateAndFillColumn(DataColumn dataColumn)
        {
            var colId   = dataColumn.Table.Columns.IndexOf(dataColumn);
            var colData = (from DataRow row in dataColumn.Table.Rows select row[colId]).ToList();

            return(TableFactory.CreateColumn(dataColumn, colData.OrderBy(o => o).Distinct()));
        }
Ejemplo n.º 2
0
        private static ITable ExtractSchema(DataTable dataTable)
        {
            //Get keys
            var keys  = dataTable.PrimaryKey.Select(k => dataTable.Columns.IndexOf(k.ColumnName)).ToList();
            var table = TableFactory.CreateTable(dataTable.Columns.Count, keys);

            table.Columns.Select(
                (c, i) =>
                new { i,
                      col = CreateAndFillColumn(dataTable.Columns[i]) }
                ).ToList()
            .ForEach(c => table.Columns[c.i] = c.col);
            return(table);
        }