As I understand it, LLBLGen Pro cannot generate POCOs over it's own entities (see here: http://www.llblgen.com/Pages/featuresLLBLGenPro.aspx).
Has anyone written a T4 that will generate POCO classes corresponding to LLBLGen Pro entities and generate the appropriate transformation logic to go to and from an entity and POCO? Has anyone else come up with a solution that doesn't involve manually writing tons of transformation code?
We generated DTOs from LLBLGen rather than using T4.
We had a need to create DTOs from an Entity. These aren't technically POCOs because they have a
ToEntity()andFromEntity()method, but perhaps this will work for you.We created an
IDTO<T>interface that was then implemented by the DTO classes (one for each entity). Rather than modifying the entity templates, we addedDTOExtensionmethods that would convert an Entity to a DTO (as well as numerous other helper conversions).Here are the template files you can use within LLBLGen v2.6. The template designer in version 3 is much easier to use, and you can convert much of this code for version 3 if you need to.
File: entityDTOInterface.template
File: entityDTO.template
File: dtoExtensions.template
FILE: DTO.tasks
Finally, add the following to the appropriate place in your *.preset file. This will define the code generation task above within your generation preset.