Entity framework 4 EF迁移显示空的Up()Down()方法,数据库中未创建表

Entity framework 4 EF迁移显示空的Up()Down()方法,数据库中未创建表,entity-framework-4,code-first,entity-framework-migrations,Entity Framework 4,Code First,Entity Framework Migrations,EF迁移显示空的Up()Down()方法 _在数据库中创建了migrationhistory,但尚未创建任何表 创建模型的代码 Public partial class Student:BaseEntity { public string name { get; set; } public string collegeName { get; set; } public int numberOfBooks { get; set; } } 模型映射代码 public pa

EF迁移显示空的Up()Down()方法 _在数据库中创建了migrationhistory,但尚未创建任何表

创建模型的代码

Public partial class Student:BaseEntity

{
    public string name { get; set; }
    public string collegeName { get; set; }
    public int numberOfBooks { get; set; }
}
模型映射代码

public partial class StudentMap: EntityTypeConfiguration<Student>
    {
        public StudentMap()
        {
            this.ToTable("Students");
            this.HasKey(c => c.Id);
            this.Property(c => c.name);
            this.Property(c => c.collegeName);
            this.Property(c => c.numberOfBooks);

        }
    }
公共部分类StudentMap:EntityTypeConfiguration
{
公共学生地图()
{
本表为ToTable(“学生”);
this.HasKey(c=>c.Id);
this.Property(c=>c.name);
this.Property(c=>c.collegeName);
this.Property(c=>c.numberOfBooks);
}
}
dbcontext的代码

 public  class CROObjectContext: DbContext
        {
            public CROObjectContext() : base("pro-nopCommerce")
            {

            }

            public virtual DbSet<Student> students { get; set; }
    }
公共类crObjectContext:DbContext
{
public CROObjectContext():base(“pro-nopCommerce”)
{
}
公共虚拟数据库集学生{get;set;}
}

重置迁移。删除_umigrationhistory表,删除Migrations文件夹,然后启用迁移,添加migration Initial。Up()中应该有代码来创建对象。如果没有,请确保您正在使用您的上下文在类外生成迁移。谢谢,它实际上运行良好。我不知道我做错了什么