title: Ef Core insert entity with relationship
body: <p>I am having issues with ef core 3.1 and sql server inserting a entity with a relationship. </p>
  
  <p>my entity I want to insert is a player with a country relationship</p>
  
  <pre><code>public class Player{
          [Key]
          public Guid Id {get;set;}
          [ForeignKey("Country")]
          public int CountryId { get; set; }
          public Country Country { get; set; } 
          ...
  }
  public class Country{
          [key]
          public int Id {get;set;}
          public string Name {get;set;}
          ...
  }
  </code></pre>
  
  <p>I want to insert it by setting the CountryId to an existing country id and I want to be able to insert it by adding the full country entity and not the id (having it insert both)</p>
  
  <p>is it possible to do this without loading the full country entity and setting the Player.Country = country or is that something that is required to get the relationship?</p>
  
  <p>currently the way it is being done i get some json with the player and countryId then using my db context do a simple _context.Player.Add(player) followed by _context.SaveCahnges().</p>