I have a SQL Server database with more than 50 tables. It was used for my web application written in ASP.NET. Now I write a new ASP.NET MVC 5 web application for new functions under the original web application folder. I create some models (about 10 tables) with code first migration enabled database.
Now I want to deploy the application to remote server. And the database connection still connect to the same existing SQL Server database.
But I always get the error :
Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
My code didn't have the models correlate to existing database tables. I don't want my code have the useless model and keep it simple. And I can't drop the existing database. Could any one tell me how can I do?