Change the field name for Foriegn Key using Code First
<p>Not new to MVC - used CodeIgniter on PHP but new to .net MVC5 and EF6.</p>

<p>I am trying to add a new table to my project which has a 0..n relationship to the Identity Management user table (AspNetUsers) which is generated by the project into a class called ApplicationUser:</p>

<pre><code>namespace GMSB.Models
{
    // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
    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 ICollection&lt;MasterCode&gt; MasterCodes { get; set; }
        public ICollection&lt;ZZZ&gt; ZZZs { get; set; }
    }
</code></pre>

<p>ZZZ is an optional collection and is defined in it's own class</p>

<pre><code>namespace GMSB.Models
{
    public class ZZZ
    {
        public int id { get; set;}
        public string textField { get; set; }

        public ApplicationIdentity User { get; set; }

    }
}
</code></pre>

<p>when I run the update-database command in the Package Manager, the new table ZZZ is created with a FK field called ApplicationIdentity_Id.  I would like the field to be called user_id or userId.  If I delete the tables and change the ZZZ model to </p>

<pre><code>namespace GMSB.Models
{
    public class ZZZ
    {
        public int id { get; set;}
        public string textField { get; set; }

        [ForeignKey("userId")]
        public ApplicationIdentity User { get; set; }

    }
}
</code></pre>

<p>and run update-database again I get an error message:
The ForeignKeyAttribute on property 'User' on type 'GMSB.Models.ZZZ' is not valid. The foreign key name 'userId' was not found on the dependent type 'GMSB.Models.ZZZ'. The Name value should be a comma separated list of foreign key property names.</p>

<p>If I add userId as a field:</p>

<pre><code>namespace GMSB.Models
{
    public class ZZZ
    {
        public int id { get; set;}
        public string textField { get; set; }
        public string userId { get; set; }

        [ForeignKey("userId")]
        public ApplicationIdentity User { get; set; }

    }
}
</code></pre>

<p>and update-database I get the error message:
GMSB.Models.ApplicationIdentity: : EntityType 'ApplicationIdentity' has no key defined. Define the key for this EntityType.
ApplicationIdentities: EntityType: EntitySet 'ApplicationIdentities' is based on type 'ApplicationIdentity' that has no keys defined.</p>

<p>what am I doing wrong?</p>