Code Templates and snippets

From OpenPetra Wiki
Revision as of 08:40, 26 April 2010 by Pokorra (talk | contribs) (Created page with '== Introduction == We use Code templates for the code generation. This allows us to write common code with placeholders. It should be easy to read and maintain, and avoids writin…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

We use Code templates for the code generation. This allows us to write common code with placeholders. It should be easy to read and maintain, and avoids writing code several times.

We use code templates for the Object Relational Mapping (ORM), ie. for the typed data tables and typed datasets. This code was previously generated with CodeDOM, but that got too complicated. The alternative would have been to have the source in strings in the generator code, but that is hard to read and to maintain.

We also use code templates for the Winforms generation, for the same reasons.

It might help to have a look at the template files, they are in csharp/ICT/PetraTools/Templates (on Git).

Concepts

Placeholders

INCLUDE

IFDEF/IFNDEF