简体   繁体   中英

How can I merge my SQL Server database with MVC auto implemented mdf database

I wanted to enable migrations for my database, then it gave me the following errors:

More than one context type was found in the assembly 'The Factory Chante'.
To enable migrations for 'The_Factory_Chante.Models.ApplicationDbContext', use Enable-Migrations -ContextTypeName The_Factory_Chante.Models.ApplicationDbContext.
To enable migrations for 'The_Factory_Chante.Models.The_FactoryDBContext', use Enable-Migrations -ContextTypeName The_Factory_Chante.Models.The_FactoryDBContext.

I then quickly realised that I have two databases in my solution and I would like merge the The_Factory_Chante.Models.ApplicaticayionDBContext auto implemented database by MVC with my already existing database.

go to tools package manager console in Visual studio enter Enable-Migration then enter Update Database -Verbose

if it fails

You will then need to specify which configuration you want to use when updating the databases.

Update-Database -ConfigurationTypeName MyRenamedConfiguration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM