Exemple #1
0
        private static void AttachDiffs(ReportParameters <RowDifference> rep, SnapshotTableDifferences tableDiffs)
        {
            var allCols = tableDiffs.RowDifferences.Where(r => r.Differences != null).SelectMany(r => r.Differences.Differences.Select(d => d.Name)).Distinct();
            var key     = tableDiffs.RowDifferences.FirstOrDefault()?.Key;

            rep.RemoveBufferLimit();
            rep.Title(tableDiffs.TableDefinition.TableName);

            rep.AddColumn(rd => rd.DifferenceType.ToString(), cc => cc.Heading("Difference"));

            if (key != null)
            {
                var keyIndex = 0;
                foreach (var keyField in key.GetFieldNames())
                {
                    rep.AddColumn(rd => rd.Key.AllKeys.Skip(keyIndex).First(), cc => cc.Heading(keyField));
                }
            }

            foreach (var col in allCols)
            {
                rep.AddColumn(rep.Lambda(rd => rd.Differences?.Differences.FirstOrDefault(fd => fd.Name == col)?.Before), cc => cc.Heading($"{col} before"));
                rep.AddColumn(rep.Lambda(rd => rd.Differences?.Differences.FirstOrDefault(fd => fd.Name == col)?.After), cc => cc.Heading($"{col} after"));
            }
        }
Exemple #2
0
        private void FormatRows(ReportParameters <SnapshotRow> tableParams)
        {
            tableParams
            .RemoveBufferLimit()
            .Title(TableDefinition.TableName);

            foreach (var column in TableDefinition.Columns)
            {
                tableParams.AddColumn(r => r.GetField(column.Name), cc => SnapshotColumnFormatter.Format(cc, TableDefinition, column));
            }
        }
Exemple #3
0
        private static void ReportDifferences(ReportParameters <RowDifference> rep, SnapshotTableDifferences tableDifferences, Output output, ChangeReportOptions changeReportOptions)
        {
            var differenceCols
                = tableDifferences.RowDifferences
                  .Where(r => r.Differences?.Differences != null)
                  .SelectMany(r => r.Differences.Differences.Select(d => d.Name)).Distinct();

            var allCols = tableDifferences.TableDefinition.Columns.Where(c => differenceCols.Contains(c.Name)).Select(c => c.Name);

            rep.Title(tableDifferences.TableDefinition.TableName);
            rep.RemoveBufferLimit();

            rep.AddColumn(rd => rd.DifferenceType.ToString(), cc => cc.Heading("Difference"));

            foreach (var col in allCols)
            {
                rep.AddColumn(rep.Lambda(rd => DifferenceDisplay(rd, col)), cc => cc.Heading(col));
            }
        }