title: EF 4.1 code first having issues in inserting parent and child objects
body: <p>I am using Ef 4.1 code first.</p>
  
  <p>I am getting the follwing error and not sure what I am doing wrong:</p>
  
  <p><strong>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.</strong></p>
  
  <p>Inner exception:</p>
  
  <p><strong>Invalid column name 'GrantApplicationIs'.
  Invalid column name 'GrantApplication_Id'.</strong></p>
  
  <p>I have a grant application and I am trying to add an audit entry to it when I save it to the database.</p>
  
  <p>Here is my context:</p>
  
  <pre><code>public class HbfContext : DbContext
  {
     public DbSet&lt;Bank&gt; Banks { get; set; }
     public DbSet&lt;AccountType&gt; AccountTypes { get; set; }
     public DbSet&lt;GrantApplication&gt; GrantApplications { get; set; }
     public DbSet&lt;AuditEntry&gt; AuditEntries { get; set; }
  }
  </code></pre>
  
  <p>Grant Application class:</p>
  
  <pre><code>public class GrantApplication
  {
     public int Id { get; set; }
     public string EmployeeNumber { get; set; }
     public string Title { get; set; }
     public string FirstName { get; set; }
     public string LastName { get; set; }
     public virtual ICollection&lt;AuditEntry&gt; AuditEntries { get; set; }
  }
  </code></pre>
  
  <p>AuditEntry class:</p>
  
  <pre><code>public class AuditEntry
  {
     public int Id { get; set; }
     public int OldValue { get; set; }
     public int NewValue { get; set; }
     public DateTime AuditDate { get; set; }
     public string EmployeeNumber { get; set; }
     public int GrantApplicationIs { get; set; }
     public GrantApplication GrantApplication { get; set; }
  }
  </code></pre>
  
  <p>This is how I add a new audit entry to a new grant application:</p>
  
  <pre><code>public void Insert(GrantApplication grantApplication)
  {
     DateTime currentDateTime = DateTime.Now;
     string submitterEmployeeNumber = "123456";
  
     grantApplication.SignatureDate = currentDateTime;
     grantApplication.SubmitterEmployeeNumber = submitterEmployeeNumber;
  
     // Add audit entry
     grantApplication.AuditEntries = new List&lt;AuditEntry&gt;();
     grantApplication.AuditEntries.Add(new AuditEntry
     {
        NewValue = grantApplication.GrantApplicationStateId,
        AuditDate = currentDateTime,
        EmployeeNumber = submitterEmployeeNumber
     });
  
     // Insert the new grant application
     grantApplicationRepository.Insert(grantApplication);
  }
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>My table structures looks like this:</p>
  
  <p><code>GrantApplications</code> table:</p>
  
  <pre><code>Id int
  EmployeeNumber varchar(6)
  Title varchar(10)
  FirstName varchar(50)
  LastName varchar(50)
  </code></pre>
  
  <p><code>AuditEntries</code> table:</p>
  
  <pre><code>Id int
  GrantApplicationId int
  OldValue int
  NewValue int
  AuditDate datetime
  EmployeeNumber varchar(6)
  </code></pre>
  
  <p>I have no idea what <code>GrantApplicationIs</code> and <code>GrantApplication_Id</code> and why they are column names.  From what?</p>