I've currently developed a .NET Core 6 application. Currently, I have generated a DB model within this .NET project using the EF Core Scaffolding command.
After this model was generated, there were a few DB schema changes (creation of new tables, adding new columns to existing tables etc.) implemented. Now in scenarios where we don't have a track of the exact changes implemented in the DB, how can we construct our Scaffolding command to properly identify and update the existing context model?
I'm looking for a way without the need to use -Force option.
Using the -Force command as follows does overwrite the existing model and also reflect the delta changes, but is there a way to only update the entities which are actually altered at DB-level rather than overwriting every single generated entity?
Scaffold-DbContext -Connection "Server=...." -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir "C:\App\TestApp\Model\Entities" -Namespace TestApp.Model.Entities -ContextDir "C:\App\TestApp\ContextData" -context TestContextName -ContextNamespace TestApp.ContextData -Project TestApp.ContextData -Force