Unable to read connection string from app.config
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- postgresql
- Domain
- databases
Research direction
Start with src/SQLProvider/Utils.fs, especially getConStringFromConfig and the referenced line that reads the connection string. Follow the attached example's docker-compose, restore, and build steps to reproduce the failure. Done means the provider successfully connects using the connection string from app.config instead of requiring it in source or at runtime.
Written by the indexing model from the issue text.
Description
Description
I'm attempting to specify the connection string to my DB in an app.config file in the root of my project, instead of hardcoding it in source. The type provider throws the following error:
No connection string specified or could not find a connection string with name DefaultConnectionString
I've read through the Utils.fs file, specifically the getConStringFromConfig function. I can see that line 235 reads match config.ConnectionStrings.ConnectionStrings.[connectionStringName]. Not sure if the double ConnectionStrings is intended? That said, I've tried a few variations of nesting in my app.config file with no luck.
Repro steps
- Download and extract the attached example
cdto root directory of exampledocker-compose updotnet restoredotnet build
Expected behavior
Successful connection to DB using connection string defined in app.config.
Actual behavior
The compiler throws the following error:
No connection string specified or could not find a connection string with name DefaultConnectionString
Known workarounds
- Hardcode the connection string in source
- Provide a connection string at runtime using
.GetDataContext connString(though doesn’t help where compilation needs to happen across differing environments)
Related information
- Used database: Postgres
- Operating system: MacOS and Windows 10 (tested on both)
- Branch:
master - .NET Runtime, CoreCLR or Mono Version: assuming CoreCLR - not sure how to be certain?
Performance information, links to performance testing scripts:
- Dominant language
- F#
- Stars
- 627
- Forks
- 147
- Avg merge
- 2h 2m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fsprojects/SQLProvider
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 55/100
fsprojects/SQLProvider#872 · 2 comments ·
-
Repo Assist? Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 10/100
fsprojects/SQLProvider#870 · 1 comment ·
-
postgresql
Difficulty 4/5 3-5 days Newbie friendliness 58/100
fsprojects/SQLProvider#869 · 2 comments ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
fsprojects/SQLProvider#868 · 2 comments ·
-
sql server
Difficulty 4/5 3-5 days Newbie friendliness 45/100
fsprojects/SQLProvider#851 · 1 comment ·