title: Entity Framework Not Adding Multiple Objects In A Domain Class To Database
body: <p>I am new to Entity Framework and trying to understand how to do this in a ASP.Net MVC 4 application.</p>
  
  <p>I have an Appointment object that contains a Customer object (customer information) and a DateTime for the appointment. I can't seem to figure out how to store the customer object correctly. </p>
  
  <p>Looking at the way I am doing things now I am thinking I should store the customer ID, but I don't know how to retrieve the customer information later (do I use the Model? Another Domain class "AppointmentDetails"? Should I use a service layer object?)</p>
  
  <pre><code>   public class Appointment
      {
          public int Id { get; set; }
          public Customer Customer { get; set; }
          public DateTime AppointmentDateTime { get; set; }
  
          public Appointment()
          {
  
          }
  
          public Appointment(Customer customer, DateTime appointmentDateTime)
          {
              Customer = customer;
              AppointmentDateTime = appointmentDateTime;
          }
      }
  </code></pre>
  
  <p>Customer.cs</p>
  
  <pre><code>   public class Customer
      {
          public int Id { get; set; }
          public string FirstName { get; set; }
          public string LastName { get; set; }
          public string Address { get; set; }
          public string City { get; set; }
          public string Province { get; set; }
          public string Phone { get; set; }
          public string Email { get; set; }
  
          public Customer()
          {
  
          }
  
          public Customer(string firstName, string lastName, string address, string city, string province, string phone, string email)
          {
              FirstName = firstName;
              LastName = lastName;
              Address = address;
              City = city;
              Province = province;
              Phone = phone;
              Email = email;
          }
      }
  </code></pre>