Model Driven Application Tutorial


In this tutorial, you wil learn how to build the foundation for a model-driven application. We will use C# as target programming language, but the same steps apply to most other object-oriented programming languages.

The tutorial consists of the following parts:

  • Part I: introduction This introduction, in which you will create the initial code generation setup.
  • Part II: generating code from a model Generate C# code from Yellicode model.
  • Part III: using framework-specific types Use .NET specific types in your model.
  • Part IV: adding custom meta data Extend your model with custom validation rules.
  • Part V: using custom meta data Use your custom meta data to generate validation code.
  • Part VI: target a different language Generate TypeScript code from the same model.


It is a prerequisite that you have both the Yellicode CLI and Yellicode Modeler installed. See Installing Yellicode for more. Some basic experience with NPM is also recommended. And, of course, any IDE that you are comfortable with for editing TypeScript files.

Set up the project directory

Let's first set up a project structure. Open your favorite terminal and create a new directory named csharp-tutorial.

Then run the yellicode init command and accept all suggested defaults...

yellicode init

... and wait until you see the message 'Yellicode initialization finished'.

If everything went well, you should now see the following files in your working directory, as well as a NPM package.json file and node_modules directory:

- codegenconfig.json
- csharp-tutorial.template.ts
- csharp-tutorial.ymn

Now replace the csharp-tutorial.ymn (which contains your Yellicode model) with this file, so that you don't need to create a model from scratch. Verify the model by opening the model file in Yellicode Modeler: it should contain a model named IssueManager, with some classes that you will find in a typical issue tracker application.

Install the C# extension

Because you are going to generate C# code, you will also need to install the Yellicode C# extension.

npm install @yellicode/csharp --save-dev

This completes our initial project setup. Let's generate some code.

Continue to Part II - Generating code from a model »