Example .NET Core 3.1 project with xUnit and connection to PostgreSQL database.
- PostgreSQL database
- .NET Core 3.1 SDK
Use this only if you don't have existing PostgreSQL database.
- Change directory to the docker directory
- Command:
cd docker
- Command:
- Run docker-compose
- Command:
docker-compose up
- Command:
- Change directory to the project folder
- Command:
cd src/ExampleSolution.Db
- Command:
- Scaffold the database
- Command:
dotnet ef dbcontext scaffold "Host=my_host;Database=my_db;Username=my_user;Password=my_pw" Npgsql.EntityFrameworkCore.PostgreSQL -c MyDbContext -o Models --context-dir .
- Command:
Additional info: