I have an object u1 of type User class. User has an attribute name. How can I pass in u1 to a T4 template ? I am trying to do something very simple:
User u1 = new User("John");
Template script:
Hello <# u1.Name #>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do you wanna use it in your template? Then you need to add a reference to the assembly containing the type. You cannot simply pass existing reference to the T4 engine unless you host it yourself in some highly unorthodox fashion (I’ve never seen anyone atempting to do this). And even if you went as far and did that how would you run it? Where is this reference supposed to come from?
Using the type from within a T4 template is as easy as adding the reference or copy/paste it in the class stub
<#+ /*stuff goes here*/ #>.