How to update models in VS 2019 from database in Entity Framework in ASP.NET Core

后端 未结 3 1934
予麋鹿
予麋鹿 2021-01-07 04:45

By VS 2019, I created an API project (database first), everything it\'s working well, now I made some changes in the database like add new tables and some property and modif

3条回答
  •  余生分开走
    2021-01-07 04:55

    Try to recreate your models via Scaffold-DbContext with "Force" param.

    Scaffold-DbContext "Data Source=yoursource;Initial Catalog=yourdb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Model -Force
    

提交回复
热议问题