I am trying to follow the tutorial from the link below to create an app that shows a list of movies from a database with crud functionality, but I am trying to add a user login. https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/
I have been trying to figure out how to add and update the migrations for the Movie database. I am able to do it when I follow the tutorial without the user login, but once I add the user login, there seems to be an issue that I am not catching.
After I create the model class, I am trying to apply the following steps for the migration
dotnet restore
dotnet ef migrations add --context MvcMovie2Context
(When I run this command, I get (Missing required argument ''.) error) dotnet ef database update --context MvcMovie2Context
(This command seems to be working for some reason)When I run the app and click on the movie link, I get the following error
SqlException: Invalid object name 'Movie'.
System.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__107_0(Task<SqlDataReader> result)
I have looked through my Model, View and Controller classes to check if I made a typo or a syntax error that would cause the object name ‘Movie’ to be invalid, so I think it means that my Movie database was not created.
I have restarted the project multiple times following the tutorial
I have attached screenshots of the command line errors and browser error. I would greatly appreciate if anyone has any hints or suggestions that they could provide me. Thanks!
I had a similar error even though all the tables were properly created. It turned out that my connection string was wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With