- install Dotnet SDK 5.0+ from official site
- install PostgreSQL
- issue the following commands one by one:
**
psql -U postgres -c "CREATE USER tcms WITH PASSWORD 'jw8s0F4' CREATEDB;"
**psql -U postgres -c "CREATE DATABASE tcms;"
**psql -U postgres -c "GRANT CREATE ON DATABASE tcms TO tcms;"
- run
dotnet ef database update --project src
to create a database schema
You have two options: use predefined user or create your own secure one. There three buildin logins (all share the same 'Pwd)12345' password):
- admin@tcms
- testman@tcms
- tester@tcms
Or register your own user
- 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
- changed the db communication to factory/shortlived context and all discovered data issues had gone
** dotnet ef dbcontext scaffold "Host=localhost;Port=5433;Database=kiwi;Username=kiwi;Password=kiwi" Npgsql.EntityFrameworkCore.PostgreSQL -o Data/Kiwi
- https://docs.microsoft.com/ru-ru/ef/core/
- https://purple.telstra.com/blog/asp-net-core-identity-with-postgresql
- https://docs.microsoft.com/ru-ru/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli
- https://codewithmukesh.com/blog/blazor-crud-with-entity-framework-core/ - creating sample CRUD
- https://docs.microsoft.com/en-us/aspnet/core/blazor/blazor-server-ef-core?view=aspnetcore-5.0