- install EF CLI
dotnet tool install --global dotnet-ef
- install PostgreSQL
- issue
psql -U postgres -c "CREATE USER tcms WITH PASSWORD 'jw8s0F4' CREATEDB;"
to create a new user - issue
psql -U postgres -c "GRANT CREATE ON DATABASE tcms TO tcms;"
dotnet ef database update
to create a database schema
- register yourself
- issue the
psql -U postgres -c "UPDATE public.\"AspNetUsers\" SET \"EmailConfirmed\" = true;" tcms
to "confirm" yourself
- project is created with
dotnet new blazorserver ...
command (added auth stuff) - removed migrations, updated provider to Postgres and generated initial migration again
- imported
dotnet ef dbcontext scaffold ...
Kiwi model and excluded it from build - moved server source code under src folder
- defined a Products model (some properties are defined in ApplicationDbContext)
** created migration
dotnet ef migrations add Products
** update databasedotnet ef database update
- added simplistic CRUD forms for products (Pages/Products). Using the article (from the refs) but skipped API/controller part, so the form communicates Db directly
** dotnet ef dbcontext scaffold "Host=localhost;Port=5433;Database=kiwi;Username=kiwi;Password=kiwi" Npgsql.EntityFrameworkCore.PostgreSQL -o Data/Kiwi