Skip to content

albi005/startsch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 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 have to 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

# Add migration
dotnet ef migrations add --context SqliteDb $MIGRATION_MESSAGE
dotnet ef migrations add --context PostgresDb $MIGRATION_MESSAGE

# Remove latest migration
dotnet ef migrations remove --context SqliteDb
dotnet ef migrations remove --context PostgresDb

# Reset migrations
rm -r Data/Migrations
dotnet ef migrations add --context SqliteDb --output-dir Data/Migrations/Sqlite $MIGRATION_MESSAGE
dotnet ef migrations add --context PostgresDb --output-dir Data/Migrations/Postgres $MIGRATION_MESSAGE

Migrations are applied automatically on server startup.

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.

About

📰 Start here

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published