Entity Framework Core 6 Problem
-
Change "public" to "dbo" in your code. Where did you find this tutorial you're following? The problem with Linq-To-Sql is that it is a dead product and no longer under development.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakOK, I think I have this now. I did the migration and update, and the DB was created and Department and Employee tables added. Next, I added a Companies entity, linked it to Departments, and ran
dotnet ef migrations add AddCompanies
dotnet ef database updateand the Db is now up to date. So I need to run these 2 commands each time I make a change?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
OK, I think I have this now. I did the migration and update, and the DB was created and Department and Employee tables added. Next, I added a Companies entity, linked it to Departments, and ran
dotnet ef migrations add AddCompanies
dotnet ef database updateand the Db is now up to date. So I need to run these 2 commands each time I make a change?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
Yes. You can make a ton of changes and wrap them all in a single migration. Open the migration file and take a look at what's generated.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Yes. You can make a ton of changes and wrap them all in a single migration. Open the migration file and take a look at what's generated.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakOK, I get it now. That book I referenced doesn't show any of this, so far. Now I get why nothing was happening when I ran my console app. I was under the impression that creating the DBContext would do all of this
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Yes. You can make a ton of changes and wrap them all in a single migration. Open the migration file and take a look at what's generated.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakHow do you get a Prod DB update to date with all the migration changes?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.