maifs
maifs

Reputation: 1171

second time model changes in codefirst

I initially generated configuration and Initialcreate classes successfully by mapping the model.

Now I changed the model (by adding one more property) and tried to execute below commands in project manager console.

The commands I have tried:

PM> add-migration

cmdlet Add-Migration at command pipeline position 1
Supply values for the following parameters:
Name: Configuration
Scaffolding migration 'Configuration'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running `Add-Migration Configuration` again.

PM> update-database -verbose

Using StartUp project 'Demo'.
The project 'Demo' failed to build.
PM> 

When I tried to execute add-migration command then it generated a partial class with same name as Configuration.cs. Now I found two Configuration files but inheritance is different between both classes. What should I do or what am I doing in wrong manner?

After that I executed the commands again with different name and it worked but when I executed the command Update-database then received an error which I mentioned below:

Table registeration already exists

Upvotes: 0

Views: 403

Answers (1)

Masoud
Masoud

Reputation: 8211

Use

add-migration YourMigrationName -force

Upvotes: 1

Related Questions