3
votes

I'm developing a web app in Asp.Net Core RC2 according to n-layered architecture.

enter image description here

When I try to use scaffolding to generate CRUD Controller and Views, I get the following error.

enter image description here

I have separated my Models/ViewModels and Context/Repository Classes into Business Logic Layer and Data Access Layer respectively. I'm referencing both these layers in OpenBiz project as nuget packages. But cannot perform scaffolding as seen above. Is there an issue with my architecture or am I missing something here?

1
Any help? Also asked this on Github repo of Scaffolding. - ar27111994
I've even re created the project but all in vain. - ar27111994

1 Answers

4
votes

Response from 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.

Plus they also opened this issue as a bug, quoting:

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:

Hence, as of RC2, this is a bug in scaffolding tooling.