Unable to read connection string from app.config
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- postgresql
- Lĩnh vực
- databases
Hướng nghiên cứu
Bắt đầu với src/SQLProvider/Utils.fs, đặc biệt là getConStringFromConfig và dòng được tham chiếu đọc chuỗi kết nối. Làm theo các bước docker-compose, restore và build của ví dụ đính kèm để tái hiện lỗi. Công việc được xem là hoàn thành khi provider kết nối thành công bằng chuỗi kết nối từ app.config thay vì yêu cầu chuỗi này trong mã nguồn hoặc lúc chạy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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:
- Ngôn ngữ chính
- F#
- Star
- 627
- Fork
- 147
- Merge trung bình
- 2 giờ 2 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fsprojects/SQLProvider
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
fsprojects/SQLProvider#872 · 2 bình luận ·
-
Repo Assist? Đang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
fsprojects/SQLProvider#870 · 1 bình luận ·
-
postgresql
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
fsprojects/SQLProvider#869 · 2 bình luận ·
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
fsprojects/SQLProvider#868 · 2 bình luận ·
-
sql server
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
fsprojects/SQLProvider#851 · 1 bình luận ·
Tất cả issue của fsprojects/SQLProvider
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
AstrBotDevs/AstrBot#10205 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OHDSI/Data2Evidence#3394 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100