-
Notifications
You must be signed in to change notification settings - Fork 2
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.
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
-
ReportGeneratorprovidesLoadRootPackage(FileInfo)(a single entry model) andLoadRootPackages(FileInfo)/LoadRootPackages(DirectoryInfo)(the entry model plus everything reachable, or every.ecorein a directory) for combined reports. -
HandleBarsReportGeneratorsets up a Handlebars.Net environment, registers the helpers from ECoreNetto.HandleBars and compiles the embedded.hbstemplates.CreateHandlebarsPayloadflattens the package tree into an orderedHandlebarsPayloadof 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.
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.
A .md document with a model-information block and Data Types, Enumeration Types and Classes sections.
An .xlsx workbook (also .xlsm/.xltx/.xltm) with a Model Info sheet and EClass, EEnum and EDataType sheets.
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.
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.ecorefile 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 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"));copyright @ Starion Group S.A.