Unable to read connection string from app.config
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- postgresql
- Ambito
- databases
Direzione di ricerca
Inizia da src/SQLProvider/Utils.fs, in particolare da getConStringFromConfig e dalla riga a cui si fa riferimento che legge la stringa di connessione. Segui i passaggi docker-compose, restore e build dell’esempio allegato per riprodurre il problema. Il lavoro è completato quando il provider si connette correttamente usando la stringa di connessione da app.config, invece di richiederla nel codice sorgente o a runtime.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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:
- Lingua principale
- F#
- Stelle
- 627
- Fork
- 147
- Merge medio
- 2h 2m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fsprojects/SQLProvider
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
fsprojects/SQLProvider#872 · 2 commenti ·
-
Repo Assist? Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
fsprojects/SQLProvider#870 · 1 commento ·
-
postgresql
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
fsprojects/SQLProvider#869 · 2 commenti ·
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 42/100
fsprojects/SQLProvider#868 · 2 commenti ·
-
sql server
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
fsprojects/SQLProvider#851 · 1 commento ·
Tutte le issue di fsprojects/SQLProvider
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AstrBotDevs/AstrBot#10205 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
OHDSI/Data2Evidence#3394 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100