我使用分层架构开发项目。我正在数据访问层迁移。单独执行迁移时,上下方法为空。可能是什么原因?
这些是我映射的代码。
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);
}
}