title: When using Entity Framework, should I set the navigation property or foreign key property, when setting the FK?
body: <p>I have some code that looks like this:</p>
  
  <pre><code>var customer = dbcontext.Customers.Find(1);
  
  var order = new Order();
  order.CustomerId = customer.Id;
  
  dbcontext.Orders.Add(order);
  dbcontext.SaveChanges();
  </code></pre>
  
  <p>Is it best practice to this or set the relationship by setting the navigation property:</p>
  
  <pre><code>var customer = dbcontext.Customers.Find(1);
  
  var order = new Order();
  order.Customer = customer; //Set navigation prop as opposed to FK field
  
  dbcontext.Orders.Add(order);    
  dbcontext.SaveChanges();
  </code></pre>
  
  <p>What approach is considered best practice or preferred?</p>