c# - ASP.NET MVC,添加 View : No model classes in dropdownlist

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

我昨天在数据迁移方面遇到了问题。我以某种方式解决了它。 这就是我解决的方法:
ASP.NET MVC : Context type not found in assembly 。 在出现迁移问题之前一切都工作正常。

今天,当我尝试在 Controller 的方法中添加 View 时。 “模型类别”下拉列表不显示任何模型。 enter image description here

项目结构和详细信息:

我的解决方案中有两个项目:“FYPPharmAssistant”和“FYPPharmAssistant.Domain”。

FYPPharmAssistant.Domain 是包含我所有实体和数据库上下文类的类库。 FYPPharmAssistant由UI和 Controller 组成。我正在使用 ASP.NET MVC 5、EF 6 和 codefirst 方法。

我也有一个困惑。第一个项目中引用的 FYPPharmAssistant.Domain 的 dll 文件是否需要在每次构建时更新?修改日期为 1 天前。但到目前为止,我已经修改了模型中的很多内容。

已经过去 36 小时,修改日期尚未更新。 enter image description here

最佳答案

在“FYPPharmAssistant”项目中,您应该添加对“FYPPharmAssistant.Domain”项目的引用,并且不要向项目添加dll引用。

在“添加引用”窗口中,在窗口左侧选择“解决方案”=>“项目”,在右侧选择“FYPPharmAssistant.Domain”,然后单击“确定”。

每次模型更改后,首先构建项目。

关于c# - ASP.NET MVC,添加 View : No model classes in dropdownlist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32282793/

相关文章:

c# - 如何在 C# 中通过 |= 运算符将负数转换为正数?

c# - asp.net mvc缺少参数时自动抛出404错误

javascript - 仅包含一项的 JSON 结果

c# - 有人可以帮助我理解以下行吗?

c# - 使用 MEF 的线程安全延迟实例化

C#,Lokad.Shared : How to write custom rules to use with Enforce

c# - LINQ to Objects - 初始化列表

linq - 获取组中存在的第一项和最后一项

c# - MVC5 发现多个类型与名为 'Home' 的 Controller 匹配

c# - Entity Framework SQL 查询执行