title: Entity Framework: Skip few columns or select as null from related entities
body: <p>I have three entities as below</p>
  
  <pre><code>public partial class Ticket
  {
      public int TicketId { get; set; }
      ...
      public virtual ICollection&lt;TicketComment&gt; TicketComments { get; set; }
  }
  
  public partial class TicketComment
  {
      public int CommentId { get; set; }
      public int TicketId { get; set; }
      ...
      public virtual ICollection&lt;CommentAttachment&gt; CommentAttachments { get; set; }
      public virtual Ticket Ticket { get; set; }
  }
  
  public partial class CommentAttachment
  {
      public int FileId { get; set; }
      public int CommentID { get; set; }
      public string FileName { get; set; }
      public int FileSize { get; set; }
      public byte[] FileContents { get; set; }  // holds large data
  
      public virtual TicketComment TicketComment { get; set; }
  }
  </code></pre>
  
  <p>Here each Ticket can have multiple comments and each Comment can have 1 or 0 attachment.
  I am trying to eager load all related entities for a given ticket with following code</p>
  
  <pre><code>var query = context.Tickets.Where(t =&gt; t.TicketId == ticketid)
               .Include(t =&gt; t.TicketComments.Select(c =&gt; c.CommentAttachments));
  </code></pre>
  
  <p>It is doing the job correctly.</p>
  
  <p>Only the problem is that, it is also loading <code>byte[] FileContents</code>, which often has quite large data. I want to avoid it.</p>
  
  <p>Is there any way i can select NULL for <code>FileContents</code> or skip this column at all?</p>
  
  <p>I had tried with following</p>
  
  <pre><code>var query = context.Tickets.Where(t =&gt; t.TicketId == ticketid)
              .Include(t =&gt; t.TicketComments
                  .Select(c =&gt; c.CommentAttachments
                      .Select(ca =&gt; new CommentAttachment()
                      {
                          CommentID = ca.CommentID,
                          FileContents = null,
                          FileId = ca.FileId,
                          FileName = ca.FileName,
                          FileSize = ca.FileSize
                      })));
  </code></pre>
  
  <p>But it is giving error</p>
  
  <pre><code>The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties. Parameter name: path
  </code></pre>
  
  <p>Any ideas to avoid loading <code>FileContents</code> column ?</p>