I have an EF model in my DAL project, I want the executing project, the web application, to be the one containing the connection string information.
I also would like being able to store the connectionString separately from the metadata EF requires.
Is this possible from web.config connectionStrings alone, or do I need some sort of code-behind to accomplish this? If that’s the case, what would be the code?
The
EntityConnectionclass contains constructor overloads that you can use to pass it in a connection string from your web.config. Keep in mind though that the connection string that EF wants is not what you typically would store in a connection string in a web.config, it has more than just the SQL Server connection information. But you can use the EntityConnectioBuilder class to help you out with that.