Click here to Skip to main content
15,886,080 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi,
I have a created two separate C# web application using EF6 (one with Database First and other with Code First approach). everything is going on smoothly but after sometime it is required to merge both.
After merging , Database is same for Code First Approach.
Initial I was using 'MigrateDatabasetoLatestVersion' for database initializer.
So when I try to run my application , it throws error related to Table is already exist. I have also tried with Package manager console to update migration and it throws same error.
and so I was not able to run the new solution on same database.

For resolving this issue, I have changed database initializer to 'CreateDatabaseifNotExist'. and after that I am able to use this database with my new solutions.

But the Problem arise, when I tried to add a new column to existing table or Creating a new table with Code First approach. Since there is no migration so it skips to alter/add table and for that I have to manually run Alter/Add table Script with each changes.

Is there any valid solution for this?
either MigrateDatabasetoLatestVersion doesn't throw exception or it is not required to run db script each time.

Thanks.
Posted
Updated 19-Sep-18 9:51am
Comments
Maciej Los 3-Sep-15 9:01am    

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900