title: DTO Generator for EF 4 Entity model
body: <p>Is it possible to write t4 template ( or if it already exists ) which will be able to generate DTO classes based on the data in the *.edmx file?</p>
  
  <p>I have to write DTO classes for the current project, and this process is kinda tiresome.</p>
  
  <p>What I trying to acquire is to get DTO classes which will have scalar properties defined as simple auto properties, and navigation parameters as incapsulated instances of other DTO classes.</p>
  
  <p>Example :</p>
  
  <pre><code>public class SomeClassDTO
  {
      public byte Id { get; set; }
  
      public string Description { get; set; }        
  
      public OtherClassDTO SomeProperty {get;set;}
  
      public IList&lt;AnotherClassDTO&gt; Objects {get;set;}
  }
  </code></pre>
  
  <p>This is a good starting point, what is more desirable may look like following sample:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Employee details DTO.
  /// &lt;/summary&gt;
  public class EmployeeDetailsDTO
  {
      [Key] 
      public long Id { get; set; }
  
      [Required] 
      public string FirstName { get; set; }
  
      [Required]
      public string Surname { get; set; }
  
      ...
  
      public long? PhotoId { get; set; }
  
      // Home address properties.
  
  
      public string HomeAddressAddressLine1 { get; set; } // This is just name of field, not flattened list 
      public string HomeAddressAddressLine2 { get; set; }
      public string HomeAddressAddressLine3 { get; set; }
      public string HomeAddressPostcode { get; set; }
      public short? HomeAddressCountryId { get; set; }
      public long? HomeAddressCountyId { get; set; }
      public long? HomeAddressTownId { get; set; }
  
  
      public short? HomeTelephoneCountryId { get; set; }        
      public string HomeTelephoneNumber{ get; set; }
      public string HomeTelephoneExtension { get; set; }
  
  
      public short? PersonalMobileCountryId { get; set; }      
      public string PersonalMobileNumber { get; set; }
      public string PersonalMobileExtension { get; set; }
  
  }
  </code></pre>
  
  <p>As you can see this is a flatten DTO which represent composite structure and may be injected back to entities through ValueInjector SameNameFlat/UnFlat injections.</p>
  
  <p>This is the ultimate goal, though any advices would be appreciated.</p>