title: How to add wcf attributes in poco template that is applicable in Complex Type?
body: <p>I use the instructions from <a href="https://stackoverflow.com/questions/3678121/adding-datamember-datacontract-attributes-in-entity-framework-poco-template">Adding [DataMember] [DataContract] attributes in Entity Framework POCO Template</a></p>
  
  <p>At first it worked, all of my complex types are generated with wcf attributed [DataContract] [DataMember].  And then when I regenerate, I don't know why all of my Complex Types have no [DataContract] [DataMember]. Only the entities have [DataContract][DataMember]</p>
  
  <pre><code>[DataContract]
  &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;#
      region.Begin("Primitive Properties");
  
      foreach (EdmProperty edmProperty in entity.Properties.Where(p =&gt; p.TypeUsage.EdmType is PrimitiveType &amp;&amp; p.DeclaringType == entity))
      {
          bool isForeignKey = entity.NavigationProperties.Any(np=&gt;np.GetDependentProperties().Contains(edmProperty));
          bool isDefaultValueDefinedInModel = (edmProperty.DefaultValue != null);
          bool generateAutomaticProperty = false;
  
  
  
  #&gt;
  
      [DataMember]
      &lt;#=PropertyVirtualModifier(Accessibility.ForProperty(edmProperty))#&gt; &lt;#=code.Escape(edmProperty.TypeUsage)#&gt; &lt;#=code.Escape(edmProperty)#&gt;
      {
  
  
  
  
  
  
  
  
  
  //------------------------------------------------------------------------------
  // &lt;auto-generated&gt;
  //     This code was generated from a template.
  //
  //     Changes to this file may cause incorrect behavior and will be lost if
  //     the code is regenerated.
  // &lt;/auto-generated&gt;
  //------------------------------------------------------------------------------
  
  using System;
  using System.Collections;
  using System.Collections.Generic;
  using System.Collections.ObjectModel;
  using System.Collections.Specialized;
  using System.Runtime.Serialization;
  &lt;#=String.Join(String.Empty, extraUsings.Select(u =&gt; "using " + u + ";" + Environment.NewLine).ToArray())#&gt;
  &lt;#+
      fileManager.EndBlock();
  }
  </code></pre>