FSharp.Data.SqlClient
FSharp.Data.SqlClient copied to clipboard
Add support working with appsettings.json in Asp.Net Core 2.x and above
Description
In core there has been a shift away from web.config files and to using appsettings.json to hold configuration settings. It would be ideal if these configuration files could be used with type providers.
Repro steps
-
Build an asp.net core application
-
Configure trivial type provider that references the name of the connection string in appsettings.json
-
Build applicaiton
Expected behavior
The expected behavior is for the type provider to be able to locate the connection string in the config file.
Actual behavior
The connection string cannot be found and the application will not build.
@rahicks26 is it something you'd like to contribute in a PR?
I haven't used new ASP.NET stuff.
To make the changes in the library, one would have to
- go over the places where
NameInConfigis used in the library: https://github.com/fsprojects/FSharp.Data.SqlClient/search?q=NameInConfig&unscoped_q=NameInConfig - add a sample project using the new appsettings.json and the provider
- add unit tests checking the new behaviour
- not change the behaviour of existing tests using the regular app.config named connection string
I'd be happy to review and merge such PR.
@smoothdeveloper yeah that sounds fun. I will take a look this weekend and see what I can make of it.