title: Using Heroku PostgreSql in ASP .Net Core 3.0
body: <p>I have got my web api application deployed on Heroku, which should remember and operate (increment/decrement) certain numbers. I thought it will be a good idea to keep those numbers in database. Since this is my hobby project, I chose to connect Heroku PosgreSql add-on with free plan to my app. So here is the question: how exactly do I connect my app to this database? I have seen a lot of tutorials, but each toturial was either too overloaded with code (and little explanations to it), or described connection to local PostgreSql database (which is not what I need). I haven't do anything to this add-on except adding it to my app on app page.</p>
  <p>Here is my Startup.cs (ConfigureServices method). ConnectionString, which I got from Postgre add-on, is located in appsettings.json.</p>
  <p><a href="https://i.stack.imgur.com/06zTF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/06zTF.png" alt="Startup.cs" /></a></p>
  <p>Here is DatabaseContext.cs.<a href="https://i.stack.imgur.com/29qsr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/29qsr.png" alt="DatabaseContext.cs" /></a></p>
  <p>DbService class contains methods for work with database (create new entry, edit existing, delete, etc).</p>
  <p>I am new to web-api and databases, so I'm sorry if this question is dumb.</p>