Page 1 of 1
How to customize T4 templates in ED
Posted: Tue 06 Sep 2016 04:51
by thomas.mutter
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
Re: How to customize T4 templates in ED
Posted: Tue 06 Sep 2016 11:17
by Shalex
Our documentation doesn't include reference for classes used in the templates, but there are some tips:
Does this help?
Re: How to customize T4 templates in ED
Posted: Thu 08 Sep 2016 12:53
by thomas.mutter
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.
Re: How to customize T4 templates in ED
Posted: Fri 09 Sep 2016 09:45
by Shalex
Thank you for your suggestion about improving documentation. We will notify you when it is implemented. There is no timeframe at the moment.