Skip to content

kkirkfield/DotnetAspireIssue2090Example

Repository files navigation

DotnetAspireIssue2090Example

This is a sample project to provide a proof of concept for the following issue: dotnet/aspire#2090

Issue 1

The following scripts will fail because the EF Tools currently stop the AppHost project and its database container before the EF Tools have a chance to connect to the database.

dotnet ef migrations add InitialMigration `
    -s .\src\AppHost\AppHost.csproj `
    -p .\src\RazorPagesApp\RazorPagesApp.csproj `
    -v
dotnet ef migrations remove `
    -s .\src\AppHost\AppHost.csproj `
    -p .\src\RazorPagesApp\RazorPagesApp.csproj `
    -v

A workaround for the time being is to use the following scripts.

dotnet ef migrations add InitialMigration `
    -s .\src\RazorPagesApp\RazorPagesApp.csproj `
    -p .\src\RazorPagesApp\RazorPagesApp.csproj `
    -v

The workaround to remove migrations is below. This forces the EF Tools to remove the most recent migration from the snapshot without being able to connect to the database.

dotnet ef migrations remove `
    -s .\src\RazorPagesApp\RazorPagesApp.csproj `
    -p .\src\RazorPagesApp\RazorPagesApp.csproj `
    -f `
    -v

Issue 2

We are also unable to apply migrations from the AppHost project because the AfterEndpointsAllocatedAsync lifecycle hook is called before the database container is started but after the endpoint port is assigned. This code has been commented out in ResourceBuilderExtensions.cs. We need a lifecycle hook that is called after all resources are running to be able to apply migrations from the AppHost project at startup.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published