Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aspire.Hosting.Azure.Sql - Deployment of Database Project not working #8383

Open
1 task done
ErikEJ opened this issue Mar 28, 2025 · 0 comments
Open
1 task done

Aspire.Hosting.Azure.Sql - Deployment of Database Project not working #8383

ErikEJ opened this issue Mar 28, 2025 · 0 comments
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Comments

@ErikEJ
Copy link

ErikEJ commented Mar 28, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When using RunAsContainer with SQL Database projects hosting extension, events do not seem to be respected.

var sqlSrv = builder.AddAzureSqlServer("sql")
    .RunAsContainer();    

var sqlDb = sqlSrv.AddDatabase("aspiretodo");

var dbPrj = builder.AddSqlProject<Projects.TodoDB>("tododb")    
    .WithReference(sqlDb);

this code in the SQL database projects extension runs without any waiting:

builder.ApplicationBuilder.Eventing.Subscribe<AfterResourcesCreatedEvent>(async (@event, ct) => {
    await RunPublish(builder, target, targetDatabaseName, @event.Services, ct);
});

If the RunAsContainer method was updated for eventing, I think this would work out of the box with the current implementation

See discussion in the issue here: CommunityToolkit/Aspire#529 (comment)

Expected Behavior

The RunAsContainer method should fire ResourcesCreatedEvent when running.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version info

.NET 8

Anything else?

<PackageReference Include="Aspire.Hosting.AppHost" Version="9.1.0" />
<PackageReference Include="Aspire.Hosting.Azure.Sql" Version="9.1.0" />
<PackageReference Include="Aspire.Hosting.SqlServer" Version="9.1.0" />
<PackageReference Include="CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects" Version="9.2.1" />
@github-actions github-actions bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

No branches or pull requests

1 participant