I am making a website with .NET core, I was already used to connecting to the base by accessing the web.config
:
string conexion = ConfigurationManager.ConnectionsString["LaConexion"].ToString();
I have a web api project with .NET core and the closest thing I see is a file called:appsettings.json
How could I create there my connection string and how to access it?
I thank you.
From the official documentation :
In the appsettings.json you have something like this:
And in the services you connect in this way:
I suggest you give a visit to http://fredyfx.com/blog which contains a series of 5 posts where I make a webapi from scratch, a pure command line connected to EF Core connected to PostgreSQL and a simple client in vue. js