【问题标题】:EF6 add-migration failsEF6 添加迁移失败
【发布时间】:2018-08-22 18:21:39
【问题描述】:

写完程序后,我想改变项目的结构。

这意味着我有一个带有接口和设计模型的通用 dll。

一个控制器 dll 和一个视图 dll。

正如您在屏幕截图中看到的,我在控制器 dll 中的 ApplicationDbContext。

Screenshot Solution Explorer Project Structure

我正在尝试创建一个 add-migration 和 update-database 但它似乎不起作用 up 和 down 方法是空的。

Configuration.cs

Migration init

这是为什么呢?一切都在 dll 中的地方,它可以工作。

感谢您的努力。

【问题讨论】:

    标签: c# asp.net .net entity-framework ef-code-first


    【解决方案1】:

    试试这个它的工作原理。

    -> Create Model Of EntityStateMedel.(if not create)
    -> Models/ApplicationDbContext.cs 
        - Create DbsetFor Your Model.
        - ex : public DbSet<EntityState> EntityStateSet { get; set; }
    -> Add-Migration -force "Name"
    -> Update-Database -verbos
    

    【讨论】:

      猜你喜欢
      • 2019-03-04
      • 1970-01-01
      • 2017-11-30
      • 2018-11-17
      • 2014-03-02
      • 2022-01-22
      • 1970-01-01
      • 2017-04-12
      • 2019-02-25
      相关资源
      最近更新 更多