Skip to content

Reporting

samatstarion edited this page Jul 5, 2026 · 1 revision

Reporting (ECoreNetto.Reporting)

The ECoreNetto.Reporting library contains the report generators that turn an Ecore model into human-readable documentation. It is the engine behind the ECoreNetto.Tools command line application, but it can also be used directly from code.

Architecture

All generators derive from a small hierarchy:

ReportGenerator (abstract)
  └─ HandleBarsReportGenerator (abstract)   Handlebars.Net environment + embedded .hbs templates
       ├─ HtmlReportGenerator               IHtmlReportGenerator     -> .html
       └─ MarkdownReportGenerator           IMarkdownReportGenerator -> .md
  ├─ XlReportGenerator                       IXlReportGenerator       -> .xlsx (ClosedXML)
  └─ ModelInspector                          IModelInspector          -> .txt
  • ReportGenerator provides LoadRootPackage(FileInfo) (a single entry model) and LoadRootPackages(FileInfo) / LoadRootPackages(DirectoryInfo) (the entry model plus everything reachable, or every .ecore in a directory) for combined reports.
  • HandleBarsReportGenerator sets up a Handlebars.Net environment, registers the helpers from ECoreNetto.HandleBars and compiles the embedded .hbs templates. CreateHandlebarsPayload flattens the package tree into an ordered HandlebarsPayload of enums, primitive types, data types, classes and interfaces; an overload aggregates the payload across multiple root packages for combined reports.
  • The Excel generator uses ClosedXML; the HTML diagrams use Microsoft.Msagl (graph layout) and Svg (SVG output).

Report generators are resolved from dependency injection in the Tools host. Adding a new report means: a generator interface + implementation in ECoreNetto.Reporting, a DI registration, a Command and a Handler in ECoreNetto.Tools.

Report types

HTML report

A single, self-contained .html document (no external assets). It renders:

  • Sections for Enumerations (with value/literal columns), Primitive Types, Data Types, Classes, Interfaces and Diagrams, with a numbered sidebar and collapsible sections (expand-all / collapse-all).
  • Per class: fully-qualified name, definition, abstract/interface flags, generalizations, specializations and containers.
  • A properties table that distinguishes attributes from references and shows the type link, multiplicity [lower..upper] and flag chips: {ordered}, {unique}, {id}, {readonly}, {transient}, {volatile}, {unsettable}, {derived}, {composite} and {opposite: …}.
  • A rules table with the OCL constraints declared on the class (read from the Ecore/OCL annotations).
  • An operations table with parameters (type + multiplicity), return type and documentation.
  • Embedded SVG diagrams: a model-wide inheritance diagram plus, per class, an inheritance tree and an association diagram; each is collapsible and downloadable as a standalone .svg.
  • Stable, unique anchors derived from EObject.Identifier, and an optional custom-HTML injection point.

Markdown report

A .md document with a model-information block and Data Types, Enumeration Types and Classes sections.

Excel report

An .xlsx workbook (also .xlsm/.xltx/.xltm) with a Model Info sheet and EClass, EEnum and EDataType sheets.

Inspection report

A .txt report of the variations in types and multiplicities and a list of classes and features that lack documentation, used to steer template based code generation.

Combined multi-file reports

A metamodel is often split over several .ecore files. Every generator can produce a single combined report for a whole multi-file metamodel via GenerateCombinedReport:

  • GenerateCombinedReport(FileInfo entryModel, FileInfo output) — the entry model plus every model reachable from it through cross-references.
  • GenerateCombinedReport(DirectoryInfo inputDirectory, FileInfo output) — every .ecore file in the directory.

The HtmlReportGenerator and MarkdownReportGenerator additionally expose string-returning overloads. Cross-file references stay resolved in the combined report. From the command line these two shapes are exposed as -r / --include-referenced-models and -d / --input-directory respectively (see ECoreNetto.Tools).

Using the generators from code

using ECoreNetto.Reporting.Generators;

var generator = new HtmlReportGenerator();

// single-file report
generator.GenerateReport(new FileInfo("model.ecore"), new FileInfo("model.html"));

// combined report of every .ecore in a directory
generator.GenerateCombinedReport(new DirectoryInfo("metamodel"), new FileInfo("combined.html"));

Clone this wiki locally