title: How to return Complex types from a WCF Data Service?
body: <p>Is it possible to return a complex type from a WCF data service that is made of collections of entity types ?</p>
  
  <p>for example :</p>
  
  <pre><code> //the complex type to return
   class Entities
   {
      ICollection&lt;Contract&gt; Contracts;
      ...
  
   }
  
   //configuration
   public partial class MyContext: DbContext
   {
      public MyContext()
          : base("name=DBEntities")
      {
      }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.ComplexType&lt;Entities&gt;();
          modelBuilder.Entity&lt;Contract&gt;().HasKey(c=&gt;c.Id);
          ...
      }
      ...
    }
  
   //the WCF Data Service
   public class PricingDataService : DataService&lt;ObjectContext&gt;, IDisposable
   {
       [WebGet]
       public Entities GetEntities()
       {
           return new Entities();
       }
    }
  </code></pre>
  
  <p>When I try the above configuration, I get an exception : </p>
  
  <pre><code>" The exception message is 'One or more validation errors 
  were detected during model     generation: System.Data.Edm.EdmEntityType: Name: 
  Each type name in a schema must be unique. Type name 'Contract' was already 
  defined."
  </code></pre>