What is the syntax for defining a SqlDataConnection Type Provider when using a connection string name from an app.config file. I have a solution with two projects in it. The main project is an an mvc 5 project and the second is an F# project. In the f# project I have defined an app.config file with a connection string to a database and defined my SqlDataConnection as this:
SqlDataConnection<ConnectionStringName="dbname", ConfigFile="app.config">
Everything seems to be wired up correctly when writing my f# code, as I am able to get intellisense on the the database tables, but once I run/debug the site I get an error that implies that the data provider is looking for the connection string in the main project. What am I missing here?
So it seems that once you run/debug your site, the data provider attempts to look for the connection string in the Web.config of the main project. So I renamed the app.config in my F# project to Web.config, and made sure to have the same connection string listed in the Web.config file of the main project as well. That way I appear to have access to the schema while coding, and when the project runs it picks up the connection string from the main project. This is a working solution for me, but if anyone can shed any more light on this, please do so. The new syntax is:
SqlDataConnection<ConnectionStringName="dbname", ConfigFile="Web.config">