Skip to content

abdurrahman/dotnet-core-postgresql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotnet-core-postgresql

A sample MVC project about how to use PostgreSQL with ASP.NET Core.

You can take a look Medium post for detailed instructions [TR]

This project uses;

  • .NET 9.0 target framework.
  • Npgsql.EntityFrameworkCore.PostgreSQL 9.0.4 NuGet package.

Project Setup

Clone repo

$ git clone https://github.com/abdurrahman/dotnet-core-postgresql.git

Update appsettings.json

Configure connection string in project's appsettings.json, replacing the username, password, and dbname appropriately (Consider to change Server name if it necessary):

"ConnectionStrings": {
    "DefaultConnection": "User ID=username;Password=password;Server=localhost;Port=5432;Database=dbname;Integrated Security=true;Pooling=true;"
},

Running the migration

Execute the following comment inside the project directory, where the .csproj file is located:

$ dotnet ef database update

After running the migration, the database is created and web application is ready to be run.

About

How to use PostgreSQL with ASP.NET Core 5.0

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published