Entity Framework GroupBy, FirstOrDefault and async thread safety
<p>Is this a safe code to write in Entity Framework?</p>

<pre><code>var apartmentQuery = ctx.apartmentRooms.OrderBy(m =&gt; m.ID)
                 .GroupBy(m =&gt; new { m.Apartment.Activity.CreatedBy, m.ApartmentID })
                 .Take(20)
                 .Select(m =&gt; m.FirstOrDefault());


                var list = await apartmentRooms.ToListAsync();
</code></pre>

<p>Since <code>FirstOrDefault</code> is in the code, is it possible to get EF threading problems while awaiting <code>ToListAsync</code>?</p>