public PivotXmlaDataSourceBuilder(PivotDataSource dataSource, ViewContext viewContext, IUrlGenerator urlGenerator) { this.viewContext = viewContext; this.urlGenerator = urlGenerator; this.dataSource = dataSource; this.dataSource.Transport.SerializeEmptyPrefix = false; }
private DataTable Convert(PivotDataSource source) { DataTable result = new DataTable(); PropertyDescriptorCollection properties = source.GetItemProperties(null); foreach (PropertyDescriptor property in properties) { if (property.Name != "PivotGridNullableColumn") { result.Columns.Add(property.Name, property.PropertyType); } } for (int i = 0; i < source.RowCount; i++) { DataRow row = result.NewRow(); foreach (DataColumn col in result.Columns) { row[col] = properties[col.ColumnName].GetValue(((IList)source)[i]); } result.Rows.Add(row); } return(result); }