title: Does Entity Framework save related classes automatically?
body: <p>Let's assume that we have such classes</p>
  
  <pre><code>public class A{
      string someField { get; set; }
      public virtual B B {get; set; }
  }
  
  public class B {
     int someIntField {get; set; }
  
     [ForeignKey("Id")]
     [Required]
     public virtual A A { get; set; } 
  }
  </code></pre>
  
  <p>In code I create new instances for both of them and making relation like:</p>
  
  <pre><code>A a = new A () { someField = "abcd"};
  B b = new B () { someIntField = 42 };
  
  A.B = b;
  B.A = a;
  </code></pre>
  
  <p>Should I using DBContext to save both classes like that:</p>
  
  <pre><code>using (var db = new myDbContext()) {
      myDbContext.As.Add(A);
      myDbContext.Bs.Add(B);
      myDBContext.SaveChanges();
  }
  </code></pre>
  
  <p>Or saving it like that:</p>
  
  <pre><code>using (var db = new myDbContext()) {
      myDbContext.As.Add(A);
      myDbContext.SaveChanges();
  }
  </code></pre>
  
  <p>is enough to store related objects into database?      </p>