I am developing an application that uses edmx for dataaccess.
I realized that each edmx file have its own connection string in the configuration file.
Is there a way to share one connection string for all the edmx files?
1 Answer
No - there isn't.
And for good reason. The connection string in Entity Framework contains much more than regular connection strings (e.g data source / database name).
It contains crucial information about the different components of the model, including the CSDL, which is unique to the model.
Perhaps you could explain if you are planning to share a connection string between different EDMX's, then why do you need seperate EDMX's in the first place?
If your looking at a way to dynamically create a connection string then look at EntityConnectionStringBuilder.
1 Comment
Jaxidian
It makes sense to use separate EDMXes if your database is large enough that you need to partition your tables up. An EDMX cannot reasonably handle over 150 tables. I couldn't even get it to respresent our entire database - we have it partitioned up into ~20 different EDMXes. That said, I totally understand the reasons for not sharing the connection strings (CSDL, SSDL, MSL). I just wanted to point out the issues with very large databases.