[英]Adding a database to web.config & External Data Model edmx in MVC Entity Framework
I am extending an existing project by adding a new process which will reside on an existing project's website (and use the same look/feel) but the new process does not interact with the existing processes. 我通过添加新流程来扩展现有项目,该流程将驻留在现有项目的网站上(并使用相同的外观),但是新流程不会与现有流程交互。 In other words, I'm adding a new feature.
换句话说,我要添加一个新功能。
The database I'm going to create will reside on the same SQL instance as the existing project's database. 我要创建的数据库将与现有项目的数据库位于同一SQL实例上。 The existing connection string in the web.config has the initial catalog set to the existing project's database.
web.config中现有的连接字符串将初始目录设置为现有项目的数据库。 I will need to switch to the new database for the pieces of the project I'm going to create.
对于将要创建的项目,我将需要切换到新数据库。 Do I need to add a new connection string to the web.config?
我是否需要向web.config添加新的连接字符串? Or is there a way to reference the new catalog using the existing connection string?
还是有一种方法可以使用现有的连接字符串来引用新目录?
I created a separate edmx. 我创建了一个单独的edmx。 To keep things organized, I placed it in a separate project folder in my solution, so the original edmx is in one folder, and the new edmx is in a separate folder.
为了使事情井井有条,我将其放在解决方案的单独项目文件夹中,因此原始edmx位于一个文件夹中,而新edmx位于一个单独的文件夹中。 I also have a separate app.config in each folder.
我在每个文件夹中都有一个单独的app.config。 So, my new folder is structured in the same way as the original one.
因此,我的新文件夹的结构与原始文件夹相同。
New Folder for my data model additions to the original project: 我的数据模型添加到原始项目的新文件夹:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.