title: Relating tables to a Microsoft Identity User - has no key defined errors
body: <p>I have followed the following and used <code>ApplicationUser</code> instead of creating my own. <code>ApplicationUser</code> comes from the default MVC 5 application:</p>
  
  <p><a href="http://blogs.msdn.com/b/webdev/archive/2013/10/20/building-a-simple-todo-application-with-asp-net-identity-and-associating-users-with-todoes.aspx" rel="nofollow">http://blogs.msdn.com/b/webdev/archive/2013/10/20/building-a-simple-todo-application-with-asp-net-identity-and-associating-users-with-todoes.aspx</a></p>
  
  <p>This is my <code>ApplicationUser</code> code:</p>
  
  <pre><code>public class ApplicationUser : IdentityUser
  {
      public async Task&lt;ClaimsIdentity&gt; GenerateUserIdentityAsync( UserManager&lt;ApplicationUser&gt; manager )
      {
          // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
          var userIdentity = await manager.CreateIdentityAsync( this, DefaultAuthenticationTypes.ApplicationCookie );
          // Add custom user claims here
          return userIdentity;
      }
  
      public virtual ICollection&lt;Field&gt; Fields { get; set; }
  }
  </code></pre>
  
  <p>And this is my <code>Field</code> code:</p>
  
  <pre><code>public class Field
  {
      [Key]
      public int FieldID { get; set; }
  
      // [ForeignKey( "Id" )] // Not sure if i needed this but neither worked
      public virtual ApplicationUser CreatedBy { get; set; }
  
      ...
  </code></pre>
  
  <p>But the following errors occur when i run <code>PM&gt; Add-Migration AddedCreatedByToFields</code>:</p>
  
  <pre><code>One or more validation errors were detected during model generation:
  
  FieldApplication.Domain.Concrete.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.
  FieldApplication.Domain.Concrete.IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType.
  IdentityUserLogins: EntityType: EntitySet 'IdentityUserLogins' is based on type 'IdentityUserLogin' that has no keys defined.
  IdentityUserRoles: EntityType: EntitySet 'IdentityUserRoles' is based on type 'IdentityUserRole' that has no keys defined.
  </code></pre>
  
  <p>Any ideas what i'm doing wrong?</p>
  
  <p><strong>Side note</strong></p>
  
  <p>I moved my <code>ApplicationUser</code> code into a seperate project called Domains. I included the Identity Nuget package to get the namespaces in it...</p>