When developing back-end system, almost 50% development time is wasted at repetitive job of writing CRUD and mapping classes. Most of the time it is wasted at class->properties definition. That’s why I try to develop a Mapper Generator, a tools which can be used to read C# class, parse it with defined structures to resulting class.
Mapper generator is a tools in which it accept C# class definition, parse it into pre-processed model using template, and furthermore will be processed into final result file using template. It is developed using C# .Net Framework 4.5, Winform, Roslyn (Microsoft.CodeAnalysis 1.0.0-rc3), StringTemplate (ST3), and Dynamic Linq Library.
Defined Sturcture Template
There are 3 general steps of converting the class definition into resulting template. First is to define the structure (template) using structure manager.
Here you can define the template in which the class will be converted. The template here are defined using StringTemplate notations. So you can use any of StringTemplate capabilities into the template.
Define the source model
Here you must define the source model (C# class) which contains the properties that you want to process. The model later then will be parsed using Roslyn and be converted into preprocessed model.
The model definition (upper part) can be checked at this screen. The model definition consist of the following hierarchy:
Tree -> Namespace -> Class -> Property
The structure template (at the middle) can be choose to pre-process the model. Then after pushing the “Generate Template” button, it will be converted into pre-processed model at the bottom screen.
This screen also enables you to download the pre-processed model into xml, which will be useful for further external-apps processing.
The generated class will be processed based on pre-processed model.
I intentionally want this project as open source. So if you think that you want to contribute or fork the base project, feel free to contact me. Feedback are also acceptable.