title: LINQ - take x objects from database for each object property value
body: <p>I have an entity:</p>
  
  <pre><code>public class Component
  {
      public Guid Id { get; set; }
      public string Name { get; set; }
      public ProductType Type { get; set; }
  }
  </code></pre>
  
  <p>ProductType</p>
  
  <pre><code>public enum ProductType
  {
      Harddrive = 1,
      GraphicCard,
      ComputerCase,
  }
  </code></pre>
  
  <p>I'm trying to get list of <strong>Product</strong> that contains 15 random items (5 per ProductType) in single LINQ.</p>
  
  <p><strong>ComputerCase, GraphicCard and Harddrive inherts from same base class</strong></p>
  
  <p>For now I have something like that:</p>
  
  <pre><code>        var response = db.Components
              .Select(x =&gt; new Product
              {
                  Id = x.Id,
                  Name = x.Name,
                  Type = x.Type,
              }).ToList();
  </code></pre>
  
  <p>but I have no idea how could I achive what I need. Can anyone help me with that?</p>