EF migration shows empty Up() Down() methods, no tables created in database

泄露秘密 提交于 2020-06-27 06:03:53

问题


EF migration shows empty Up() Down() methods _migrationhistory created in database but no tables has been created

code for creating model

Public partial class Student:BaseEntity

{
    public string name { get; set; }
    public string collegeName { get; set; }
    public int numberOfBooks { get; set; }
}

code for model mapping

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

        }
    }

code for dbcontext

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

            }

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

来源:https://stackoverflow.com/questions/36359799/ef-migration-shows-empty-up-down-methods-no-tables-created-in-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!