Пример #1
0
 private static void GetRows(Core.Common.Items.MatrixFeatures.Matrix gridMatrix, DataTable data)
 {
     data.BeginLoadData();
     foreach (var row in gridMatrix.Rows.AsParallel())
     {
         var obj = GetRow(row).ToArray();
         data.LoadDataRow(obj, true);
     }
     data.EndLoadData();
 }
Пример #2
0
        public DataTable TransformToDataTable(Core.Common.Items.MatrixFeatures.Matrix gridMatrix)
        {
            var data = new DataTable();

            data.Columns.Add("DataObjectId", typeof(long));
            data.PrimaryKey       = new DataColumn[] { data.Columns["DataObjectId"] };
            data.DefaultView.Sort = "DataObjectId asc";

            var row = gridMatrix.Rows.First();

            var unionCols = GetUnionColumns(row);

            foreach (var key in unionCols)
            {
                data.Columns.Add(key.Name, key.Type);
            }

            data.Columns.Add(nameof(row.Class), typeof(int));

            GetRows(gridMatrix, data);

            return(data.DefaultView.ToTable());
        }