title: Call Methods in Transformtext() Method at T4 Preprocessed Template
body: <p>I use T4 and Preprocessed Template to generate some codes. So When I add all of the templates directly in .tt file every things is OK like the following:</p>
  
  <pre><code>&lt;#@ template language="C#" #&gt;
  &lt;html&gt;&lt;body&gt;
  &lt;h1&gt;Sales for Previous Month&lt;/h2&gt;
  &lt;table&gt;
      &lt;# for (int i = 1; i &lt;= 10; i++)
         { #&gt;
           &lt;tr&gt;&lt;td&gt;Test name &lt;#= i #&gt; &lt;/td&gt;
               &lt;td&gt;Test value &lt;#= i * i #&gt; &lt;/td&gt; &lt;/tr&gt;
      &lt;# } #&gt;
   &lt;/table&gt;
  This report is Company Confidential.
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>But I need to grouped codes in some methods and call methods in <code>transformText()</code> Method:</p>
  
  <p>MyTemplate.tt file is like the following:</p>
  
  <pre><code>&lt;#@ template language="C#" #&gt;
  &lt;#+ 
  
      private string header(){
  #&gt;
  &lt;html&gt;&lt;body&gt;
  &lt;h1&gt;Sales for Previous Month&lt;/h2&gt;
  
  &lt;#+ 
      return this.GenerationEnvironment.ToString();
  }
  
  
  private string body() {
  #&gt;
      &lt;table&gt;
      &lt;#+ for (int i = 1; i &lt;= 10; i++) { #&gt;
  
       &lt;tr&gt;&lt;td&gt;Test name &lt;#= i #&gt; &lt;/td&gt;
           &lt;td&gt;Test value &lt;#= i * i #&gt; &lt;/td&gt; &lt;/tr&gt;
      &lt;#+ } #&gt;
   &lt;/table&gt;
  &lt;#+ 
      return this.GenerationEnvironment.ToString();
  }
  
  
  private string footer(){
  #&gt;
      This report is Company Confidential ..
  &lt;/body&gt;&lt;/html&gt;
  &lt;#+ 
      return this.GenerationEnvironment.ToString();
  }
  #&gt;
  </code></pre>
  
  <p>And related MyTemplate.cs file is like the following:</p>
  
  <pre><code>// .... 
  
  public virtual string TransformText()
      {
          return this.GenerationEnvironment.ToString();
      }
  // .... 
  </code></pre>
  
  <p>So I call the methods in <code>TransformText()</code> method like this:</p>
  
  <pre><code>// .... 
  
   public virtual string TransformText()
      {
          header();
          body();
          footer();
          return this.GenerationEnvironment.ToString();
      }
  // .... 
  </code></pre>
  
  <p>So every thing is OK yet, but if I change any thing in .tt file and Save it, the .cs file regenerated again and <code>TransformText()</code> Method return to first implementation (without any calling)? </p>
  
  <p>So how can I use some methods and generate codes in Preprocessed Template? What is your suggestion? </p>