protected override void FillColumnsTable(DiagramTableItem item, Dictionary <int, Box> colNameBoxes, TableBox table) { var fkColsIndexes = GetFkColIndexes(item.Table); IPrimaryKey pk = item.Table.FindConstraint <IPrimaryKey>(); int fldindex = 0; table.ColumnDelimiter = new FixedBox { BackgroundBrush = Brushes.Black, FixedSize = new Size(1, 1) }; if (pk != null) { foreach (IColumnStructure col in item.Table.Columns) { if (pk.Columns.IndexOfIf(cr => cr.ColumnName == col.ColumnName) >= 0) { var row = table.AddRow(); row.AddCell("PK", ColumnBold, Brushes.Black); var cname = row.AddCell(col.ColumnName, col.IsNullable ? ColumnRegular : ColumnBold, Brushes.Black); if (colNameBoxes != null) { colNameBoxes[fldindex] = cname; } } fldindex++; } table.RowDelimiterOverrides[pk.Columns.Count] = new FixedBox { BackgroundBrush = Brushes.Black, FixedSize = new Size(1, 1), MarginTop = 2, MarginBottom = 2 }; } foreach (IColumnStructure col in item.Table.Columns) { if (pk == null || pk.Columns.IndexOfIf(cr => cr.ColumnName == col.ColumnName) < 0) { var row = table.AddRow(); if (fkColsIndexes.ContainsKey(col.ColumnName)) { row.AddCell("FK" + (fkColsIndexes[col.ColumnName] + 1).ToString(), ColumnRegular, Brushes.Black); } else { row.AddCell(new FixedBox { FixedSize = new Size(16, 16) }); } var cname = row.AddCell(col.ColumnName, col.IsNullable ? ColumnRegular : ColumnBold, Brushes.Black); if (colNameBoxes != null) { colNameBoxes[fldindex] = cname; } } fldindex++; } }
protected override void FillColumnsTable(DiagramTableItem item, Dictionary <int, Box> colNameBoxes, TableBox table) { var fkColsIndexes = GetFkColIndexes(item.Table); int fldindex = 0; foreach (var col in item.Table.Columns) { var row = table.AddRow(); if (item.Table.GetKeyWithColumn <IPrimaryKey>(col) != null) { row.AddCell(CoreIcons.primary_key); } else if (fkColsIndexes.ContainsKey(col.ColumnName)) { row.AddCell(CoreIcons.foreign_key); } else { row.AddCell(new FixedBox { FixedSize = new Size(16, 16) }); } var cname = row.AddCell(col.ColumnName, col.IsNullable ? ColumnRegular : ColumnBold, Brushes.Black); if (colNameBoxes != null) { colNameBoxes[fldindex] = cname; } row.AddCell(item.GetFullTypeName(col), ColumnRegular, Brushes.Black); fldindex++; } }