0

I have a large number of tables in my database and I want to create multiple Entity Data Models. I want them all to reference the same connection string in either my web.config or app.config.

right now, when I go through the wizard in vs2012 to create each model, it seems to create a new configuration entry in my app.config with it's own credentails. Maybe somehow I'm not picking the right options?

What is a clean way to do this so I just have one connection string that is used for all my Entity Data Models?enter image description here

4

2 回答 2

1

When you are developing using visual studio each model needs it's own connection string.

But your code does not need to use these connection strings. There is a constructor for the Context that allows you to send in a connection string. If you use this, you could have a single connection string in your app settings, which is used for all Contexts (models).

于 2013-03-31T20:52:07.807 回答
0

Unfortunately each Entity data model (EDMX file) must have its own connection string because the connection string references XML files created from that model (that are those csdl, ssdl and msl things referenced in the connection string). If you want to have just one DB connection string you will have to build entity connection strings in your application.

于 2013-03-30T18:57:37.370 回答