title: Getting varbinary data EF Core taking too long
body: <p>I have these two models which are mapped to SQL tables using EF Core code first:</p>
  <pre><code>public class Profile
  {
   public int ID { get; set; }
   public string FirstName { get; set; }
   public string LastName { get; set; }
   public IEnumerable&lt;Attachment&gt; Attachments { get; set; }
   // Other props
  }
  
  public class Attachment
  {
   public int ID { get; set; }
   public int ProfileId { get; set; }
   public Profile Profile { get; set; }
   public string FileName { get; set; }
   public byte[] BinaryContent { get; set; }
  }
  </code></pre>
  <p>I am trying to fetch these data like this:</p>
  <pre><code> var profileWithAttachments = await _context.Profiles.Include(x =&gt; x.Attachments)
                          .Where(x =&gt; x.ID == profileId)
                          .ToListAsync();
  </code></pre>
  <p>It takes too long to load for example a query which returns about <strong>80 rows</strong>, each of them containing  varbinary data to about <strong>100kb</strong> takes about <strong>30 seconds</strong>. Important to know is that executing this query on SQL Server takes only <strong>2 seconds</strong>! I also have tried using <strong>Dapper</strong> or plain <strong>ADO.NET</strong> but same results. The issue normally seems to be the <strong>BinaryContent</strong> column because if I exclude this column it takes less than a second.
  Are there any solutions to these problem or just saving to the file system or blob storage is the only way to go probably?</p>