Additions and extensions for .NET data-protection (ASP.NET Core).
- Configuring data-protection through AppSettings.json
- Azure - the url is just an example
- FileSystem
- Redis - you need to setup Redis, see below
- Redis (connection-string) - || -
- Sqlite
- SqlServer
Setup Redis locally with Docker:
docker run --rm -it -p 6379:6379 redis
- Haven't got it yet how the url should be composed.
We might want to create/recreate migrations. If we can accept data-loss we can recreate the migrations otherwhise we will have to update them.
Copy all the commands below and run them in the Package Manager Console for the affected database-context.
If you want more migration-information you can add the -Verbose parameter:
Add-Migration TheMigration -Context TheDatabaseContext -OutputDir Data/Migrations -Project Project -StartupProject Application -Verbose;
Write-Host "Removing migrations...";
Remove-Migration -Context SqliteDataProtectionContext -Force -Project Project -StartupProject Application;
Remove-Migration -Context SqlServerDataProtectionContext -Force -Project Project -StartupProject Application;
Write-Host "Removing current migrations-directory...";
Remove-Item "Project\Data\Migrations" -ErrorAction Ignore -Force -Recurse;
Write-Host "Creating migrations...";
Add-Migration SqliteDataProtectionContextMigration -Context SqliteDataProtectionContext -OutputDir Data/Migrations/Sqlite -Project Project -StartupProject Application;
Add-Migration SqlServerDataProtectionContextMigration -Context SqlServerDataProtectionContext -OutputDir Data/Migrations/SqlServer -Project Project -StartupProject Application;
Write-Host "Finnished";
Write-Host "Updating migrations...";
Add-Migration SqliteCacheContextMigrationUpdate -Context SqliteDataProtectionContext -OutputDir Data/Migrations/Sqlite -Project Project -StartupProject Application;
Add-Migration SqlServerCacheContextMigrationUpdate -Context SqlServerDataProtectionContext -OutputDir Data/Migrations/SqlServer -Project Project -StartupProject Application;
Write-Host "Finnished";