Making a new database from an existing project in entity framework

时间:2016-02-25 11:25:15

标签: c# asp.net entity-framework asp.net-web-api

I have little experience with entity framework. I have been given an ASP.net web application and it has a database which written in entity frameworks and it runs in the person local computer. I would like to create a new database which contains all of the information (tables, data, etc) inside the database.

i have tried to change the connection string to my localDB but i have no idea on how to create the tables inside my localdb.

i have tried to search for a way but it does not give the answer that i am looking for. Can anybody help me with this problem or maybe someone can direct me to the solution which are already there for my problem?

Thank you

1 个答案:

答案 0 :(得分:1)

  • 首先更改"目录= DBName"在连接字符串中,

  • 然后打开包管理器控制台类型命令update-database,按回车键。 它可以帮助您创建新数据库。

  • 如果显示有关迁移的错误。

  • 编写命令add-migration按enter键,然后为迁移提供名称。

  • 现在再次编写命令update-database并等待成功消息,直到种子正在运行。

相关问题