Basic Program to -
- Connect to Postgres DB
- Code-First approach in creating Table
- Read/Write operation to DB
- version 1.0.0 - Basic EF Framework
- version 2.0.0 - Adding Seed Data
- Run postgres DB n check via pgAdmin UI
docker run --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:latest
docker run -p 80:80 -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' -d dpage/pgadmin4
Note: Command to get Database Hostname used in pgAdmin
docker inspect <postgres-dockerContainerId> | grep IPAddress
- Install EF Framework (if not already installed)
dotnet tool install --global dotnet-ef
- Create Migration script using -
dotnet ef migrations add InitialState
dotnet ef database update
- Run the program.