How to customize T4 templates in ED

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
thomas.mutter
Posts: 2
Joined: Thu 11 Aug 2016 17:09

How to customize T4 templates in ED

Post by thomas.mutter » Tue 06 Sep 2016 04:51

Where can I find documentation about the provided objects inside T4 templates in ED?
We need to slightly change the provided templates which generates the dbcontext and model. It would be very helpful to find a documentation about classes like EntityContextModel or CsModelCodeProvider in the namespace EntityDeveloper.EntityFramework.

What is the idea of how customers deal with these templates?

Regards, Thomy

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: How to customize T4 templates in ED

Post by Shalex » Tue 06 Sep 2016 11:17

Our documentation doesn't include reference for classes used in the templates, but there are some tips: Does this help?

thomas.mutter
Posts: 2
Joined: Thu 11 Aug 2016 17:09

Re: How to customize T4 templates in ED

Post by thomas.mutter » Thu 08 Sep 2016 12:53

Thanks for your reply. Although this is a bit bad news. Since debugging code the T4 template in ED is not possible, accessing variables like model results in try-and-error session.

The documentation in Templage System Concepts is pretty good, but it basically describs the T4 concept itself but not the specific data structures and parameters in which the template is executed.

As an example, we would like to extend the generated POCO with a DebuggerDisplayAttribute on the POCO-class. For the value-parameter I need the name of the primary key of the entity. I'm sure that there is a way to find this information somewhere in the ContextModel, but I have no way to definively find it out.

There are more requirements to implement like that.

So I would suggest to extend the documentation and describe all the context objects in which code generation happens so that your customers are able to write their own T4 templates.

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: How to customize T4 templates in ED

Post by Shalex » Fri 09 Sep 2016 09:45

Thank you for your suggestion about improving documentation. We will notify you when it is implemented. There is no timeframe at the moment.

Post Reply