title: Entity Framework Core: remove a relationship but not delete the entities
body: <p>How would you delete a relationship assuming you had the 2 entities, but did not have the 'relationship' entity?</p>
  
  <p>Assuming the following entities...</p>
  
  <p>Model classes:</p>
  
  <pre><code>public class DisplayGroup
  {
          [Key]
          public int GroupId { get; set; }
          public string Description { get; set; }
          public string Name { get; set; }
          public ICollection&lt;LookUpGroupItem&gt; LookUpGroupItems { get; set; }
  }
  
  public class DisplayItem
  {
          [Key]
          public int ItemId { get; set; }
          public string Description { get; set; }
          public string FileType { get; set; }
          public string FileName { get; set; }
          public ICollection&lt;LookUpGroupItem&gt; LookUpGroupItems { get; set; }
  }
  
  public class LookUpGroupItem
  {
          public int ItemId { get; set; }
          public DisplayItem DisplayItem { get; set; }
          public int GroupId { get; set; }
          public DisplayGroup DisplayGroup { get; set; }
  }
  </code></pre>
  
  <p>Here is the code for deleting a relationship. <strong>Note:</strong> I do not want to delete the entities, they just no longer share a relationship.</p>
  
  <pre><code>public void RemoveLink(DisplayGroup g, DisplayItem d)
  {
      _dataContext.Remove(g.LookUpGroupItems.Single(x =&gt; x.ItemId == d.ItemId));
  }
  </code></pre>
  
  <p>The method above causes an error:</p>
  
  <blockquote>
    <p>System.ArgumentNullException occurred<br>
    Message=Value cannot be null.</p>
  </blockquote>
  
  <p>It looks like this is the case because <code>LookUpGroupItems</code> is null, but these were called from the database. I would agree that I do not want to load all entity relationship objects whenever I do a Get from the database, but then, what is the most efficient way to do this?</p>
  
  <p><strong>Additional NOTE</strong>: this question is not about an argument null exception. It explicitly states how to delete a relationship in Entity Framework Core.</p>