title: Entity Framework One To Many IQueryable
body: <p>So, i was jugglin with this <a href="https://www.tutorialspoint.com/entity_framework/entity_framework_first_example.htm" rel="noreferrer">tutorial</a> as i need to optimize some queries. However, i realized on one to many relation EF tend to retrieve all related rows first and further queries done in memory - somewhat inefficient and might chew your memory into the last bits. Is there any way (or best practice) to hook one to many (or perhaps many to many) relations in EF that returns <a href="https://msdn.microsoft.com/en-us/library/system.linq.iqueryable(v=vs.110).aspx" rel="noreferrer">IQueryable</a> instead of ICollection?</p>
  
  <p>Basic EF one to many</p>
  
  <pre><code>public class parent
  {
     [Key]
     public int ParentId;
     public string Name;
     public virtual ICollection&lt;Child&gt; Childs;
  }
  
  public class Child
  {
    [Key]
    public int ChildId;
    public string Name;
    public int ParentId;
    [ForeignKey("ParentId")]
    Public Parent Parent;
  }
  </code></pre>
  
  <p>Well, as a bit background information, i come from <a href="https://laravel.com/api/5.3/Illuminate/Database/Eloquent/Relations/Relation.html" rel="noreferrer">Laravel</a>. Perhaps it just me expecting the non-existent on C#.Net. But heck doing a Linq on 3000+ records in memory is no fun, especially if you'll only take few of them. Does i am missing something? I have read <a href="https://stackoverflow.com/questions/6470278/entity-framework-code-first-iqueryable">this</a> querstion, it just simply unsightly to throw <code>.Where</code> by id for retrieving relations as it will scatter (and obsecure) the very definition of ORM - make keys management centralized and upper layer did not required to know what defines the relation of the object. Please, enlighten me.</p>
  
  <p><strong>Edit</strong>
  Thanks whoever down voted this. I really appreciate it. Cheers.</p>