Skip to content

Latest commit

 

History

History
31 lines (28 loc) · 966 Bytes

File metadata and controls

31 lines (28 loc) · 966 Bytes

NpgsqlDemo

This project shows how to use Ngpsql to connect a C# console app to the Pagila database.

  • Fork this repo on GitHub.

  • Go to Visual Studio to clone your forked repo.

    • Git menu -> Clone Repository
    • Under Browse Repositories, click the GitHub button.
    • Select your NgpsqlDemo repo and click Clone.
  • Go to Solution Explorer in Visual Studio

    • Right-click NpgsqlDemo
      • Select Manage Nuget Packages
      • Browse
        • Search for Microsoft.Extensions.Configuration
          • Install
        • Search for Microsoft.Extensions.Configuration.Json
          • Install
        • Search for Npgsql
          • Install
    • Right-click NpgsqlDemo
      • Add -> New Item
      • Name the file appsettings.json
  • Paste this code in appsettings.json:

{
  "ConnectionStrings": {
    "Pagila": "Host=YOURSERVERNAME;Port=5432;Database=pagila;Username=YOURUSERNAME;Password=YOURPASSWORD"
  }
}