microsoft / microsoft/aspire

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

Open
#8,383 2 comments 3 reactions 0 assignees View on GitHub
area-app-model area-integrations
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] 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.

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

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

var dbPrj = builder.AddSqlProject("tododb")
.WithReference(sqlDb);
```

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

```
builder.ApplicationBuilder.Eventing.Subscribe(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: https://github.com/CommunityToolkit/Aspire/issues/529#issuecomment-2748805879

### 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?

```xml

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.