title: EF 4.5 .tt file that has the POCO entities
body: <p>I want to place two using directives in a EF 4.5 edmx .tt file and am having trouble. The 4.0 syntax was different and easier to manipulate.</p>
  
  <p>Any help would be appreciated.... 
  EF 4.0 syntax:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  </code></pre>
  
  <p>4.5 syntax</p>
  
  <pre><code>public string UsingDirectives(bool inHeader, bool includeCollections = true)
      {
          return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
              ? string.Format(
                  CultureInfo.InvariantCulture,
                  "{0}using System;{1}" +
                  "{2}",
                  inHeader ? Environment.NewLine : "",
                  includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
                  inHeader ? "" : Environment.NewLine)
              : "";
      }
  </code></pre>
  
  <p>I need to add the following attributes in the .tt file:</p>
  
  <p>EF 4.0 syntax</p>
  
  <pre><code>[Serializable]
  [DataContract(IsReference = true)]
  &lt;#=Accessibility.ForType(entity)#&gt; &lt;#=code.SpaceAfter(code.AbstractOption(entity))#&gt;partial class &lt;#=code.Escape(entity)#&gt;&lt;#=code.StringBefore(" : ", code.Escape(entity.BaseType))#&gt;
  {
  &lt;#
  </code></pre>
  
  <p>4.5 syntax</p>
  
  <pre><code>public string EntityClassOpening(EntityType entity)
      {
          return string.Format(
              CultureInfo.InvariantCulture,
              "{0} {1}partial class {2}{3}",
              Accessibility.ForType(entity),
              _code.SpaceAfter(_code.AbstractOption(entity)),
              _code.Escape(entity),
              _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
      }
  </code></pre>
  
  <p>4.0 syntax</p>
  
  <pre><code>void WriteProperty(string accessibility, string type, string name, string getterAccessibility, string setterAccessibility)
  {
  #&gt; [DataMember]
      &lt;#=accessibility#&gt; &lt;#=type#&gt; &lt;#=name#&gt; { &lt;#=getterAccessibility#&gt;get; &lt;#=setterAccessibility#&gt;set; }
  &lt;#+
  }
  </code></pre>
  
  <p>4.5 syntax
  I can't find any similiar syntax**</p>
  
  <p>Basically, I want the output of the class when it's regenerated from the edmx file to look like this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Runtime.Serialization; using System.ServiceModel; 
  namespace YeagerTechModel
  {
     [Serializable] 
     [DataContract(IsReference = true)]    
     public partial class Priority 
      {
          public Priority()
          {
              this.Projects = new HashSet&lt;Project&gt;();
          }
  
       [DataMember]         
       public short PriorityID { get; set; }
      [DataMember]         
       public string Description { get; set; }
       [DataMember]         
       public virtual ICollection&lt;Project&gt; Projects { get; set; }
      }
  
  }
  </code></pre>