迁移时,up和down方法为空

时间:2016-12-05 17:18:08

标签: c# entity-framework migration code-first

我使用分层架构开发项目。我正在数据访问层迁移。单独执行迁移时,上下方法为空。可能是什么原因?

这些是我映射的代码。

public class BlogContext : DbContext
{
    public BlogContext()
        : base("Blog")
    {


    }

    internal DbSet<Article> Article { get; set; }
    internal DbSet<Category> Category { get; set; }
    internal DbSet<Comment> Comment { get; set; }
    internal DbSet<Gender> Gender { get; set; }
    internal DbSet<Member> Member { get; set; }
    internal DbSet<Entities.Task> Task { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Configurations.Add(new ArticleMap());
        modelBuilder.Configurations.Add(new CategoryMap());
        modelBuilder.Configurations.Add(new CommentMap());
        modelBuilder.Configurations.Add(new GenderMap());
        modelBuilder.Configurations.Add(new MemberMap());
        modelBuilder.Configurations.Add(new TaskMap());

        base.OnModelCreating(modelBuilder);
    }


}

0 个答案:

没有答案