Blog içindeki snippets
Shellefcoredotnetmigrationscli
EF Core CLI (Clean Setup)
Clean Architecture'da EF Core migration komutları — startup project ve design-time factory.
Kod
efcore-migrations-cli.sh
Shell
# Infrastructure projesinden migration ekle
dotnet ef migrations add Initial \
--project src/Infrastructure \
--startup-project src/Api \
--output-dir Persistence/Migrations
# Tüm migration'ları uygula
dotnet ef database update \
--project src/Infrastructure \
--startup-project src/Api
# Son migration'ı geri al
dotnet ef migrations remove \
--project src/Infrastructure \
--startup-project src/ApiNotlar
IDesignTimeDbContextFactory<AppDbContext> implemente etmeyi unutma — startup project'in appsettings.Development.json bağlantısını okuması için.