I am currently following some tutorials in order to learn how to use ASP.NET to create APIs:
First I used
dotnet ef add migrations RecipesEntity
in the Package Manager Console and everything was fine. Then I used
dotnet ef database update
and reading the console, it seems my migrations have been added but once I head over to the SQL Server Management Studio, I can't find the database nor the tables (I refreshed, restarted the programs, restarted my laptop)?
I couldn't find anyone with this problem online. Originally my connection string was:
"DefaultConnection": "Server=localhost\\sqlexpress;Database=myDataBase;Trusted_Connection=True;"
but that was causing another error that I was trying to fix for hours so in the end when I changed it it worked for at least showing the database update logs in the console.
CodePudding user response:
You are probably not connecting to the same instance of SQL Server in SSMS as the dotnet ef update
is applying the changes to.
localhost and localhost\SQLEXPRESS are two different SQL Server instances (with different databases). Make sure the "Server Name" in the SSMS login screen shows only localhost
and not localhost\sqlexpress