title: Stop EF From Loading Entities When Assigning Association
body: <p>Using Entity framework v4, and the POCO entity generator T4 templates.</p>
  
  <p>The problem I have is that the Fixup methods are loading hundreds of entities when I assign an associated entity (see line 4 below).</p>
  
  <pre><code>Dim context = New SomeEntities
  Dim list = context.Lists.FirstOrDefault(Function(l) l.ListId = 2)
  Dim queryDetail = context.CreateObject(Of QueryDetail)()
  queryDetail.CriteriaColumnType = context.CriteriaColumnTypes.FirstOrDefault(Function(cct) cct.CriteriaColumnTypeId = 145)
  </code></pre>
  
  <p>The <code>CriteriaColumnType</code> entity that is being assigned has a collection of <code>QueryDetail</code> objects, and when the assignment is made, the FixUp method on the <code>CriteriaColumnType</code> entity is lazy loading all of the associated <code>QueryDetails</code>.</p>
  
  <p>How can I create the FK association and attach the <code>CriteriaColumnType</code> entity to my <code>QueryDetail</code> entity without loading all of the <code>CriteriaColumnType's</code> <code>QueryDetail</code> records?</p>