Tuesday, May 13, 2025

c# - EF - How to refresh existing DB into EF model

If you have DB and if you want to refresh it`s model into MODEL directory, call this:
dotnet ef dbcontext scaffold "Server=(LocalDB)\MSSQLLocalDB;
AttachDbFilename=C:\_projects\vs\FioTax\FioTax\db.mdf;
Integrated Security=True;Connect Timeout=30" Microsoft.EntityFrameworkCore.SqlServer 
--output-dir Models --context AppDbContext --force

No comments:

Post a Comment