FSharp.Data.SqlClient icon indicating copy to clipboard operation
FSharp.Data.SqlClient copied to clipboard

Add support working with appsettings.json in Asp.Net Core 2.x and above

Open rahicks26 opened this issue 5 years ago • 2 comments

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

  1. Build an asp.net core application

  2. Configure trivial type provider that references the name of the connection string in appsettings.json

  3. 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 avatar Jan 27 '20 19:01 rahicks26

@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 NameInConfig is 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 avatar Jan 27 '20 20:01 smoothdeveloper

@smoothdeveloper yeah that sounds fun. I will take a look this weekend and see what I can make of it.

rahicks26 avatar Jan 28 '20 14:01 rahicks26