Skip to content

albi005/StartSch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StartSCH

Development

Configuration

Push notifications (optional)

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:..."

Database

Migrations

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 

Injecting a Db instance

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.

Releases

No releases published

Packages

No packages published