Md Tanvir Asad
Md Tanvir Asad

Reputation: 11

if we update our database how we add model class in our project in database first approach EF core

When I add a new table in my database which use in my database first approach EF project I get some error and problem in my project and newly created DB wasn't attached in my project.

Upvotes: 0

Views: 231

Answers (1)

Md Tanvir Asad
Md Tanvir Asad

Reputation: 11

Step 1: After Create Table in Database then open you Package Manager Console

Step 2: Use the following Command for add your new table model class

Scaffold-DbContext "Server=Server name;Database=Database name;User Id=User name;Password=password;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force

Step 3: Hit Enter

Note: Here only add -Force command with previous migration command

Upvotes: 1

Related Questions