简体   繁体   中英

How easy is it to change DB in a MVC3 project?

Basically I have made a MVC3 application that connects to and updates a database that exsists on a server. This database is a test one however, and when I roll out the project live I need it to connect to the actual database. My question is how hard would it be to change the project/application to point at this new database?

I used the database first method, and am aware I would need to change my connection string. I feel it is unlikely to be as simple as that.

Any help, tips or tutorials would be greatly appreciated.

只要数据库结构是相同的,它只是这么简单。

You just need to change the connection string.

Additionaly if you would like to deploy 2 versions of the website, each using it's own connection strings (for example for developpement and production) you can create 2 web.config files. Refer to this link SO question

It shouldn't be that hard. You just need to make sure that the database that you are working on now and the database that you are changing to are equal in table names and column names otherwise you are going to have configure it to use the new database tables and columns.

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