title: Data Service using EF - is it possible to use WebGet method which returns a custom type?
body: <p>In my project I use Data Service which use EF. Now I have a custom class which I also want to expose through my Data Service, but I can't make it work, it's seems like it is impossible to mix custom types and EF in single Data Service. Any suggestions?</p>
  
  <p>Looks like it doesn't find some info in meta-data.</p>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>The server encountered an error
    processing the request. The exception
    message is 'Unable to load metadata
    for return type
    'System.Linq.IQueryable<code>1[ITS.NetProject.Model.CustomEnty]'
    of method
    'System.Linq.IQueryable</code>1[ITS.NetProject.Model.CustomEnty]
    GetCustomEnties()'.'. See server logs
    for more details. The exception stack
    trace is:....</p>
  </blockquote>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>   [ServiceBehavior(IncludeExceptionDetailInFaults=true)]
          public class ITSServiceOData : DataService&lt;ITSEntities&gt;
          {
              public static void InitializeService(DataServiceConfiguration config)
              {
  
                  config.SetEntitySetAccessRule("*", EntitySetRights.All);
  
                  config.SetServiceOperationAccessRule("GetCustomEnties",                
      ServiceOperationRights.AllRead);
  
                  config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
              }
  
  
              [WebGet]
              public IQueryable&lt;CustomEnty&gt; GetCustomEnties()
              {
                  return from e in this.CurrentDataSource.CustomEnties select e;
  
              }
  
          }
  
  ///Here it is my model definition
  
  namespace ITS.NetProject.Model
  {
      partial class ITSEntities
      {
          public IQueryable&lt;CustomEnty&gt; CustomEnties 
          {
              get
              {
                  return ...
              }
          }
      }
  
  //Company, Equipment, Owner are EF entity classes
      [DataServiceKey("Id")]
      public class CustomEnty
      {
          public int Id {get;set;}
  
          public Subject Company { get; set; }
  
          public Subject Equipment { get; set; }
  
          public Subject Owner { get; set; }
      }
  }
  </code></pre>