Skip to content

SysML2.NET.CodeGenerator

samatrhea edited this page Apr 29, 2024 · 5 revisions

The SysML2.NET.CodeGenerator project contains convention-based HandleBars.NET code generators that use the SysML2 Ecore meta-model as input for code-generation. The Starion Group ecorenetto library is used to parse the SysML.ecore model.

NOTE: The code-generators are executed by running the associated test fixtures of the SysML2.NET.CodeGenerator.Tests project.

Project Structure

The following folders are present in the code generator project:

Data Model

The SysML2 data model is maintained using UML and is converted to an Ecore model. The source models can be found here SysML.uml and here SysML.ecore, the Ecore model is manualy copied from the Systems-Modeling/SysML-v2-Pilot-Implementation git repository to the data model folder on each monthly release.

Extensions

The Extensions namespace (folder) contains static extension methods to support code generation specific to the SysML.Ecore metamodel. For instance, the QueryCSharpTypeName and QueryGraphQLTypeName provide (hard-coded) mappings of a Type in the Ecore model to its C# or GraphQL counterpart.

Generators

The Generators namespace (folder) contains all the code generators.

HandleBarHelpers

The HandleBarHelpers namespace (folder) contains the custom Block Helpers that are used by the codegenerators. Block helpers make it possible to define functionality that can invoke the passed block with a new context.

Inspector

The ModelInspector class is used to perform a variability analysis of the SysML.Ecore model to investigate and report on all the variations in data-types, multiplicity, inheritance etc. that are presented in the datamodel

Templates

The generator templates are located in the Templates folder. The following applies to the templates:

  • The templates extension shall be .hbs
  • The build action property of the file shall be set to None
  • The Copy to Output Directory property of the file shall be set to Copy Always.
Clone this wiki locally