Skip to content

UML Code Generation ‐ Convention

Antoine Théate edited this page Jan 8, 2026 · 3 revisions

Class and Interface Generation

All classes produce a C# interface, only concrete classes produce a C# class.

Inheritance

Since the UML classes can have multiple Generalization, the C# inheritance is done only via interfaces.

Property Type Convention

Data Type Mapping

The following Data Type can be found into the UML model:

  • Boolean: translates to C# bool
  • UnlimitedNatural: translates to C# string
  • String: translates to C# string
  • Integer: translates to C# int
  • Real: translates to C# double
  • Enumeration: translate to correspondant C# enum

Reference Property Mapping

POCO

Translates to a reference to the Interface definition of the specified type

DTO

Translates to a Guid

Non-Scalar Multiplicity Mapping

For Data Type and Enumeration

  • [0..1]: Translates to nullable (Except for string, which is nullable by definition)
  • [1..]/[n..]: Translates to List{T}

For Reference Property

POCO
  • [0..1]: Not a nullable since a reference type is nullable by definition
  • [1..*]/[n..*]: Translates to List{T}
DTO
  • [0..1]: Translates to Guid?
  • [1..*]/[n..*]: Translates to List{Guid}

Property Name Convention

For all non-derived properties, property name starts with an uppercase.
For all derived properties, property name starts with a lowercase.

Redefined Properties

For now, when a property is redefined (inside the same context), it is defined as explicit interface implementation since we figured out that some redefinition properties have the same name as the redefined one (example: EnumerationDefinition class have to implement the IsVariation property that redefines the IsVariation defined at the Definition level).

Property Accessibility

POCO

  • Nominal Case: translates to { get; set; }
  • ReadOnly: translates to { get; }
  • Derived or DerivedUnion: Translates to => this.Compute$PROPERTYNAME$();. This method is hand-coded to implement derive-computation logic

DTO

  • Nominal Case: translates to { get; set; }
  • ReadOnly: translates to { get; }
  • Derived or DerivedUnion: translates to { get; } on interface definition, { get; internal set; } on class implementation

Redefine and Subset implementation

Subset

Not implemented for now

Redefine

Getter and setter of redefined properties throws InvalidOperationException currently but is have to be changed

JSON Serialization

  • Property name follows the CamelCase format
  • @type (string) property required (value is the name of the serialized)
  • @id (uuid) property (optional)

Data Type serialization

  • Boolean: translates to json bool
  • UnlimitedNatural: translates to json string
  • String: translates to json string
  • Integer: translates to json numeric
  • Real: translates to json numeric
  • Enumeration: translate to full lowercase string

Reference Property

A refence is represented through a JSON object which that contains one property @id with the value of the reference Guid

Multiplicity

  • [0..1]: Always serialized, null in case of null, the value otherwise
  • [1..*]/[n..*]: Serialized through a JSON array

Derived property

The serialization of derived is currently not supported but have to be implemented

Redefined property

Redefined property should be serialized. The only question is which value have to be serialized in case of redefined property that have a redefinition with a same name (cfr. example with EnumerationDefinition).

Clone this wiki locally