This simple tool uses Roslyn API to find out about the code, and reads entity properties and generates corresponding DTO object, with mapper class attached.
Generate DTO objects from entities - Use existing EF code first entities (does not need to be EF, though) and generate DTO classes to use in servce layer.
Allow custom code in DTO - Surround any custom code with predefined comments to ensure that it is not deleted.
Regenerate DTO - Use simple UI to generate and regenerate DTO with preserving custom code.
Generate mapper - Generate helper class, a mapper, which can be used to map DTO to entity, or use it as selector expression in EF queries.
Features & Benefits
All developers know it can be a pain-in-the-a** to maintain DTO objects, so we use software like AutoMapper which does this for us. However, they are allways a sort of "black box" - and can be a bit risky to use in terms of maintenance.
This simple tool uses Roslyn API to find out about the code, and reads entity properties and generates corresponding DTO object, with mapper class attached.
Ivan Cesar is a teaching assistant on University of Applied Sciences, Zagreb, Croatia. In his free time, he participates in various .NET projects. https://www.linkedin.com/in/ivancesar