title: Unable to determine a valid ordering for dependent operations
body: <p>I'm using Entity Framework 4.1
  I have a "DomainEntities" table that holds the common info for all my domain entities.
  I have a users table the the UserID is a Foreign Key from "DomainEntities".</p>
  
  <p>see EDMX:
  <img src="https://i.stack.imgur.com/rVjDh.png" alt="EDMX file"></p>
  
  <p>When I run the following code i get an error:</p>
  
  <blockquote>
    <p>Unable to determine a valid ordering for dependent operations.
    Dependencies may exist due to foreign key constraints, model
    requirements, or store-generated values.</p>
  </blockquote>
  
  <p>The code:</p>
  
  <pre><code>static void addUserTest()
  {
      DomainEntity userToAdd = new DomainEntity()
      {
          EntityName = "Test User",
          EntityTypeID = DomainEntity.eEntityType.User,
          EntityCreationDate = new DateTime(),
          EntityLastUpdateDate = new DateTime(),
          EntityCreatorUserID = 0,
          EntityUpdaterUserID = 0,
          EntityParentID = null,
          UserDetails = new User()
          {
              Username = "TestUser",
              Password = "123",
              FirstName = "Test",
              LastName = "User"
  
          }
      };
  
      using (var context = new CamelotDB())
      {
          context.DomainEntities.Add(userToAdd);
          context.SaveChanges();
      }
  
  }
  </code></pre>
  
  <p>I cant understand what is the reason that EF can understand what is the INSERT order required,
  It should be One record into "DomainEntities" and then one record into "Users".
  What am I doing wrong ?</p>