title: An error occurred while saving entities that do not expose foreign key properties for their relationships
body: <p>I declare some entities like this :</p>
  
  <pre><code>Entity myEntity = new Entity();
  myEntity.InnerProperties = new InnerProperties();
  myEntity.OuterProperties = new OuterProperties();
  </code></pre>
  
  <p>When I debug the code, the Id of myEntity and both properties' Id is 0. When I run these lines :</p>
  
  <pre><code>_context.Entities.Add(myEntity);
  _context.SaveChanges();
  </code></pre>
  
  <blockquote>
    <p>I get this exception :  {"An error occurred while saving entities that
    do not expose foreign key properties for their relationships. The
    EntityEntries property will return null because a single entity cannot
    be identified as the source of the exception. Handling of exceptions
    while saving can be made easier by exposing foreign key properties in
    your entity types. See the InnerException for details."}</p>
  </blockquote>
  
  <p>And I get this as Inner Exception : </p>
  
  <blockquote>
    <p>Store update, insert, or delete statement affected an unexpected
    number of rows (0). Entities may have been modified or deleted since
    entities were loaded. See
    <a href="http://go.microsoft.com/fwlink/?LinkId=472540" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=472540</a> for information on
    understanding and handling optimistic concurrency exceptions.</p>
  </blockquote>
  
  <p>Am I getting this exception because Id's are all zero? Or am I missing something else? </p>
  
  <p>One other thing is, there is an int field in Entity, I'm not filling that field. Is it the source of the exception?</p>
  
  <p>Thanks.</p>