title: entity framework linq include and grouping
body: <p>I'm trying  to  to do include and group in in one sentence </p>
  
  <pre><code>var instanceIdList = context.
      Tracks.
      Include("Services").
      GroupBy(x =&gt; x.ServiceId).
      Take(top);
  </code></pre>
  
  <p>but when I check the result at debug I cant see any of the include values </p>
  
  <p>I tried to do in another way </p>
  
  <pre><code>var objectContext = ((IObjectContextAdapter)context).ObjectContext;
  var set = objectContext.CreateObjectSet&lt;Track&gt;();
  var instanceIdList = set.Include("Services").GroupBy(x =&gt; x.ServiceId);
  </code></pre>
  
  <p>this is the classes :
   <em>Track</em></p>
  
  <pre><code>  public partial class Track
  {
      public long Id { get; set; }
      public System.Guid ServiceId { get; set; }
      public Nullable&lt;System.Guid&gt; ServiceInterfaceId { get; set; }
      public Nullable&lt;System.Guid&gt; ProviderId { get; set; }
      public System.Guid ServiceInstanceId { get; set; }
      public System.Guid ActivityParentId { get; set; }
      public System.Guid ActivityInstanceId { get; set; }
      public int ActivityType { get; set; }
      public int ServiceRole { get; set; }
      public int TrackOrder { get; set; }
      public System.DateTime Datetime { get; set; }
      public Nullable&lt;System.Guid&gt; MessageId { get; set; }
      public int Status { get; set; }
      public Nullable&lt;int&gt; ESBErrorCode { get; set; }
      public Nullable&lt;int&gt; ESBTecnicalErrorCode { get; set; }
      public string ErrorDescription { get; set; }
      public string PortName { get; set; }
      public string MachineName { get; set; }
      public string ConsumerId { get; set; }
      public string ExternalId { get; set; }
      public string ConsumerMachineName { get; set; }
      public int ServiceBehavior { get; set; }
  
      public virtual Message Message { get; set; }
  }
  </code></pre>
  
  <p><em>Service</em></p>
  
  <pre><code>      public partial class Service
        {
          public Service()
          {
          this.Providers = new HashSet&lt;Provider&gt;();
          this.ServiceInterfaces = new HashSet&lt;ServiceInterface&gt;();
              }
  
      public System.Guid ServiceId { get; set; }
      public string ServiceName { get; set; }
      public string ServiceNumber { get; set; }
      public Nullable&lt;System.Guid&gt; ModelSchemaId { get; set; }
  
      public virtual ICollection&lt;Provider&gt; Providers { get; set; }
      public virtual ICollection&lt;ServiceInterface&gt; ServiceInterfaces { get; set; }
  }
  </code></pre>
  
  <p>but the result is the same</p>
  
  <p>thanks </p>
  
  <p>miki</p>