- .NET 9 SDK
- make sure you can run
dotnet --info
and it shows9.x.x
under .NET SDKs installed
- make sure you can run
- bun
- make sure you can run
bun
- make sure you can run
Go to https://auth.sch.bme.hu/console/create, set Átirányítási cím to
http://localhost:5264/signin-oidc
,
then use the created credentials in the following commands:
git clone https://github.com/kir-dev/StartSCH
cd StartSCH/StartSch
dotnet user-secrets set AuthSch:ClientId $YOUR_AUTHSCH_CLIENTID
dotnet user-secrets set AuthSch:ClientSecret $YOUR_AUTHSCH_CLIENTSECRET
dotnet run
When sending push notifications, most push services, for example Apple, require a VAPID key pair. You can use Push Companion to generate these.
dotnet user-secrets set Push:PublicKey "..."
dotnet user-secrets set Push:PrivateKey "..."
dotnet user-secrets set Push:Subject "mailto:..."
After modifying the Db
, you have to create new migrations:
# Go to the server project directory (e.g. ~/src/StartSCH/StartSch)
cd StartSch
# Make sure you can run `dotnet ef`.
# One of these commands, ideally the first one, should install it.
dotnet tool restore
dotnet tool install dotnet-ef
dotnet tool install dotnet-ef --global
# 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.
- Docs: DbContext Lifetime, Configuration, and Initialization
- Docs: ASP.NET Core Blazor with Entity Framework Core
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.