Skip to content

feat(core): B1.1 — per-output views (multi-view hook) - #65

Merged
thiagoluga merged 2 commits into
masterfrom
feat/b1-1-multiview-outputs
Jul 1, 2026
Merged

feat(core): B1.1 — per-output views (multi-view hook)#65
thiagoluga merged 2 commits into
masterfrom
feat/b1-1-multiview-outputs

Conversation

@thiagoluga

Copy link
Copy Markdown
Owner

First code of Epic B1 — OSS/MIT. A single source read can now feed several outputs, each with its own filters and/or columns (a "view"), producing one file per view. The Pro workbook writer (views → sheets in one .xlsx) is B1.2.

This is the general "multi-view" model from your 2.5 clarification: at save time, several outputs with distinct filters/columns; each targets its own file here (free), or gets packed as sheets in one workbook (Pro).

API

new ReportBuilder<Sale>("sales")
    .From(source)
    .Column(v => v.Id, "Id")                                   // report default columns
    .To(Csv(), view => view.Where(v => v.Amount > 0))          // "approved" file, default columns
    .To(Csv(), view => view                                    // "rejected" file, its own columns
        .Where(v => v.Amount <= 0)
        .Column(v => v.Id, "Id").Column(v => v.Customer, "Customer"));

To(spec) (no view) is unchanged — it uses the report's filters/columns.

Pipeline change (additive, default path byte-identical)

  • TypedBatchReader<T> takes one OutputProjection<T> (filters + getters) per output and projects them all in one pass; ProjectedBatch carries per-output rows + a WrittenCount (distinct source rows written to ≥1 output).
  • CompiledReport gains OutputSchemas; the runner initializes each writer with its own schema and writes batch.Outputs[i] to output i.
  • recordsWritten uses WrittenCount, which equals the old batch.Rows.Count when outputs share a projection — so all existing behavior is preserved.

Tests

54 green Core (+3): views filter/project independently from one read; a row in several views counts once; a view with no columns (and no report columns) is rejected. Jobs (16) and AspNetCore (10) unaffected — the single-output pipeline is byte-identical.

Docs

PLAN B1.1 ✅; the design doc + DECISIONS record the multi-view model and the resolved calls: package NeoReports.Xlsx.Pro; license Option A (QuestPDF-style / PolyForm Small Business — free < USD 1M, paid above, no enforcement); CSV-with-views rejects; multi-source (B2) = two explicit join strategies.

Next

B1.2 — the NeoReports.Xlsx.Pro package: XlsxWorkbook(...) fluent API + ClosedXML writer that packs views as sheets in one file, plus the PolyForm Small Business LICENSE.

First code of Epic B1, OSS/MIT. A single source read can now feed several outputs, each
with its own filters and/or columns (a "view"), producing one file per view. The Pro
workbook writer (views as sheets in one .xlsx) is B1.2.

- ReportBuilder<T>.To(spec, view => view.Where(...).Column(...)) declares an output's own
  view; To(spec) keeps using the report's filters/columns.
- The pipeline projects PER OUTPUT in a single pass: TypedBatchReader<T> takes one
  OutputProjection<T> (filters + getters) per output; ProjectedBatch carries per-output
  rows plus a WrittenCount (distinct source rows written to >=1 output). CompiledReport
  gains OutputSchemas (per-output schema); the runner initializes each writer with its
  own schema and writes batch.Outputs[i] to output i.
- Default single-output path is byte-identical (all existing tests green): recordsWritten
  uses WrittenCount, which equals the old batch.Rows.Count when outputs share a projection.

Tests: 54 green Core (+3) — views filter/project independently from one read; a shared row
counts once; a view without columns (and no report columns) is rejected. Jobs (16) and
AspNetCore (10) unaffected. Docs: PLAN B1.1 done; design doc + DECISIONS record the
multi-view model and the resolved decisions (package NeoReports.Xlsx.Pro; license Option A
QuestPDF-style / PolyForm Small Business, free < USD 1M, no enforcement; CSV-with-views
rejects; multi-source = two explicit join strategies).
Explicit types where not apparent (IDE0008), collection expressions for the view lists
(IDE0028), and in the test the Page return type and hoisted expected arrays (CA1859/CA1861).
No behavior change; 54 green.
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@thiagoluga
thiagoluga merged commit 6695b0b into master Jul 1, 2026
5 checks passed
@thiagoluga
thiagoluga deleted the feat/b1-1-multiview-outputs branch July 1, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant