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; }
}