我正在根据 n 层架构在 Asp.Net Core RC2 中开发 Web 应用。
当我尝试使用脚手架生成 CRUD Controller 和 View 时,出现以下错误。
我已将我的模型/ View 模型和上下文/存储库类分别分为业务逻辑层和数据访问层。我将 OpenBiz 项目中的这两个层都引用为 nuget 包。但是不能像上面看到的那样执行脚手架。我的架构有问题还是我遗漏了什么?
最佳答案
来自 Github 的回复:
currently there is an issue with scaffolding, that it doesn't support model classes outside of the current project properly.
As a workaround, you can add the model temporarily to your web project and then move it to the BLL/ DAL projects after scaffolding.
另外他们还开了this issue as a bug , 引用:
Scaffolding fails if model class is in a dependency (project/ library) of the project on which scaffolding is being run. #251
Project A has a dependeny on Project B. Project B has model class If you try to run scaffolding on Project A by using model class from Project B, it fails with the below error: No model type returned for type:
因此,从 RC2 开始,这是脚手架工具中的错误。
关于c# - 错误 : multiple types matching the name while Scaffolding ASP. NET Core MVC RC2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37723998/