C# EntityFramework-具有密钥(PK)的实体不会往返

C# EntityFramework-具有密钥(PK)的实体不会往返,c#,entity-framework,C#,Entity Framework,在运行asp.net mvc解决方案时,我遇到了这个错误 异常详细信息:System.Data.Entity.Core.MappingException: (261,10):错误3004:映射从第261行开始的片段时出现问题:未为集合文件中的properties File.ImageFile指定映射。 具有密钥(PK)的实体在以下情况下不会往返: 实体类型为[MTECommerce.Models.File] 我试图做的是将一对多关系附加到我的AspNetUsers 我希望能够将文件链接到用户 以

在运行asp.net mvc解决方案时,我遇到了这个错误

异常详细信息:System.Data.Entity.Core.MappingException: (261,10):错误3004:映射从第261行开始的片段时出现问题:未为集合文件中的properties File.ImageFile指定映射。 具有密钥(PK)的实体在以下情况下不会往返: 实体类型为[MTECommerce.Models.File]

我试图做的是将一对多关系附加到我的AspNetUsers

我希望能够将文件链接到用户

以下是我所做的更改

public class ApplicationUser : IdentityUser
{
    ....
    public virtual ICollection<File> Images { get; set; }
    ...
}
EF迁移文件

        CreateTable(
            "dbo.Files",
            c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    CreationDate = c.DateTime(nullable: false),
                    ModifiedDate = c.DateTime(nullable: false),
                    ImagePath = c.String(),
                    User_Id = c.String(maxLength: 128),
                })
            .PrimaryKey(t => t.Id)
            .ForeignKey("dbo.AspNetUsers", t => t.User_Id)
            .Index(t => t.User_Id);

我可以得到一些关于哪里可能出错的指导吗。

ImageFile在Db中不受支持。。。标记为[未映射]或从中删除entity@Seabizkit非常感谢。这正是问题所在。
        CreateTable(
            "dbo.Files",
            c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    CreationDate = c.DateTime(nullable: false),
                    ModifiedDate = c.DateTime(nullable: false),
                    ImagePath = c.String(),
                    User_Id = c.String(maxLength: 128),
                })
            .PrimaryKey(t => t.Id)
            .ForeignKey("dbo.AspNetUsers", t => t.User_Id)
            .Index(t => t.User_Id);