Ejemplo n.º 1
0
        private DataTable MapDataTable(string tableName, DataTable dataTable)
        {
            DataTable result = new DataTable();

            foreach (DataColumn column in dataTable.Columns)
            {
                string property = NameMap.GetPropertyName(tableName, column.ColumnName);
                result.Columns.Add(new DataColumn(property));
            }
            foreach (DataRow row in dataTable.Rows)
            {
                DataRow newRow = result.NewRow();
                foreach (DataColumn column in dataTable.Columns)
                {
                    string property = NameMap.GetPropertyName(tableName, column.ColumnName);
                    newRow[property] = row[column];
                }
                result.Rows.Add(newRow);
            }
            return(result);
        }