EF迁移显示空的Up()Down()方法,在数据库中没有创建表

时间:2016-04-01 15:10:04

标签: entity-framework-4 code-first ef-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 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);

        }
    }

dbcontext的代码

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

            }

            public virtual DbSet<Student> students { get; set; }
    }

0 个答案:

没有答案