How to add connection string in asp.net core
Loading
How to add connection string in asp.net core
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajesh GamiPosted Jan 3, 2023, 6:10 AM
1) https://www.c-sharpcorner.com/blogs/database-connections-in-asp-net-core-20
2) https://stackoverflow.com/questions/39083372/how-to-read-connection-string-in-net-core
Vishal JoshiPosted Jan 3, 2023, 6:22 AM
Hello Peter,
You can store the connection string in appsettings.json file.
You can get the connection string from JSON file using GetConnectionString() and setup in a startup.cs file as shown in the below code.
Thanks