C
C#14mo ago
yatta

❔ What could possibly be the reason when I run database -update but no tabled added ?

Pretty much as the title says, I run the command as in the image wanting to update my new created entity into my database, but when I check the database, there's no new table added, can someone help me what could possibly go wrong here ?
9 Replies
undisputed world champions
did you Add-Migration before? this should add a migration with all the changes since the last migration was created after that you can Update-Database to apply the new migration to the database (creating the new table)
yatta
yatta14mo ago
i did, I have this migration
undisputed world champions
that doesn't look right (the methods should have code in them) did you add a DbSet<...> for your new type to your dbcontext?
yatta
yatta14mo ago
im not sure I've made any action on my dbcontext, I'll check it then
trunksvn
trunksvn14mo ago
you should have something like this in ur class "nameDBContext"
trunksvn
trunksvn14mo ago
Then you override the method OnModelCreating(ModelBuilder modelBuidler) and configure each table with each property definitions
trunksvn
trunksvn14mo ago
in my case i do this:
trunksvn
trunksvn14mo ago
up to you how should it look
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts