title: EF: how to add 2 objects using the same NEW object in one transaction
body: <p>My web application is using EF as ORM. The problem is that when I want to add House and Home object with the same address (Address object is also new in database), the error appears:</p>
  
  <p>The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.Houses_dbo.Houses_AddressId". 
  The conflict occurred in database "devDB", table "dbo.Houses", column 'Id'.</p>
  
  <p>Code doing inserts:</p>
  
  <pre><code>Address address = new Address(){Id=-1, AddressValue ="AAA"};
  Home home = new Home(){Address = address }
  Office office = new Office(){Address = address }
  
  context.Offices.Add(office);
  context.Homes.Add(home);
  context.SaveChanges();
  </code></pre>