denakol / T4Mapping

Generate mapping methods DO models to DTO with t4 template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DtoMapping

Generate extension methods for mapping DO models to DTO with t4 template

Usage

  1. Take 2 files MapHelper.tt, VisualStudioHelper.tt
  2. Create Attributes Map and MapIgnore
  3. Create own template with options like MappingExtension.tt

Options

MapHelper.MapExtensionNameSpace = "ConsoleApplicationParceAttribute";
MapHelper.MapExtensionClassName = "MapExtensionsViewModel"; 
MapHelper.MapAttribute = "Map"               // Map Attribute name
MapHelper.MapIgnoreAttribute = "MapIgnore";  // Ignore field Attribute name
MapHelper.DtoSuffix = "Dto";                 // suffix for DTO classes - ignored when compare
MapHelper.DoSuffix = "ViewModel";            // suffix for DO classes - ignored when compare
MapHelper.DoProjects.Add("DataObject");      // list of projects with DO classes
MapHelper.DtoProjects.Add("DataTransferObject");  // list of projects with DTO classes

Example output mapping methods see here

you can map objects with code

var dtoObj = doObj.MaptToDto();

About

Generate mapping methods DO models to DTO with t4 template

License:MIT License


Languages

Language:C# 100.0%