Reputation: 1968
I am trying to scaffold views based on a ViewModel in ASP.NET Core 5 project and have been finding it difficult passing through the following stage
I used to be able to pass this stage by deleting the Data Context field but that seems to have become impossible recently. Any ideas on how to scaffold a razor view with a ViewModel on ASP.Net Core 5?
With the DataContext field, it generates an error as shown
The model doesnt need a key. It is a ViewModel. It does not even need to be in the AppDbContext file and it does not need to be be in the database for any reason
Upvotes: 7
Views: 1392
Reputation: 21
The datacontext class says it's required but it's actually not.
I had the same problem and you can just leave it like it is
empty and Click Add.
ASP.NET CORE 7
Upvotes: 2