Some push services might require that the server identifies itself with a VAPID key pair. It is required by Apple. Keys can be generated here.
dotnet user-secrets set Push__PublicKey "..."
dotnet user-secrets set Push__PrivateKey "..."
dotnet user-secrets set Push__Subject "mailto:..."
After modifying the Db
you must create new migrations:
dotnet tool install dotnet-ef --global
# Go to the server project directory (StartSch/StartSch)
cd StartSch
# Describe the migration
export MIGRATION_MESSAGE=AddSomethingToSomeOtherThing
# SQLite for development
dotnet ef migrations add --context SqliteDb $MIGRATION_MESSAGE
# PostgreSQL for production
dotnet ef migrations add --context PostgresDb $MIGRATION_MESSAGE
Migrations are applied automatically when the server starts.
The last migration can be removed with:
dotnet ef migrations remove --context SqliteDb
dotnet ef migrations remove --context PostgresDb
Depending on where you want to access the database, you have to decide between injecting Db
or IDbContextFactory<Db>
.
For example, static forms or API controllers that run in a scope should use Db
, while methods in an interactive Blazor component should request a new Db
instance every time they run.