Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Must add db context (program.cs) before scaffolding with aspnet-codegenerator #32561

Open
jfoshee opened this issue May 10, 2024 · 0 comments
Open
Assignees
Labels
aspnet-core/svc Source - Docs.ms Docs Customer feedback via GitHub Issue tutorials/subsvc

Comments

@jfoshee
Copy link
Contributor

jfoshee commented May 10, 2024

Description

In the section Scaffold movie pages under the tab for Visual Studio Code the instructions are sequenced to first show use of the aspnet-codegenerator CLI, then how to modify Program.cs to configure the context w/ SQLite and SQL Server.

I think the order should be reversed.

If the reader attempts to invoke the aspnet-codegenerator command prior to configuring the context, s/he will get an error like the following

Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Movie'
Unable to create a 'DbContext' of type 'MvcMovie.Data.MvcMovieContext'. 
The exception 'Unable to resolve service for type
'Microsoft.EntityFrameworkCore.DbContextOptions`1[MvcMovie.Data.MvcMovieContext]'
...

Page URL

https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-model?view=aspnetcore-8.0&tabs=visual-studio-code

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/tutorials/first-mvc-app/adding-model.md

Document ID

48e81b42-7c2b-afbf-71e6-d4f442a4bd1f

Article author

@wadepickett

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspnet-core/svc Source - Docs.ms Docs Customer feedback via GitHub Issue tutorials/subsvc
Projects
None yet
Development

No branches or pull requests

3 participants