[英]Restore a local Sql Server database used by Entity Framework
I'm a beginner with the use of Entity Framework
: I have done a web application using EF
so i created a local Sql Server database and i added a context class EFDbContext . 我是使用
Entity Framework
的初学者:我已经使用EF
完成了Web应用程序,因此我创建了本地Sql Server数据库,并添加了上下文类EFDbContext 。
When i run the application in another machine i got this error : 当我在另一台机器上运行应用程序时,出现此错误:
The model backing the 'EFDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
i think it is because the local database is missing. 我认为这是因为缺少本地数据库。 So i need to know:
所以我需要知道:
Sql Server Manager
and the integrated connection tool
in VS ? Sql Server Manager
和VS中的integrated connection tool
管理数据库之间有什么区别? As per comments, you can create the database in the new machine using Package Manager Console
. 根据注释,您可以使用
Package Manager Console
在新计算机中创建数据库。 Please follow the following steps. 请按照以下步骤操作。
(1). PM> enable-migrations
(2). PM> add-migration db_migrationX
(3). PM> update-database.
Note: you may not need (1) and (2) if you have created migrations before. 注意:如果您之前已创建迁移,则可能不需要(1)和(2)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.