-
Couldn't load subscription status.
- Fork 712
Description
With:
- Add support for managed identity in Azure Cosmos DB hosting component (dotnet/aspire#7092)
- Add custom application model for EventHubs emulator (dotnet/aspire#7005)
- Add Service Bus emulator support (dotnet/aspire#6737)
We added Hosting app models for CosmosDB Databases, EventHub Hubs, and ServiceBus Topics and Queues.
We didn't make these app models derive from "Resource", which means they lose out on things like:
- being referenceable
- being able to "wait for"
For example, with EventHubs Allow specifying an Event Hub to use as the default EntityPath for namespace connection string, we are having to work around these limitations. But if EventHub "Hub" was a resource, we could make an app WithReference on the EventHub "Hub". See #7105 (comment) for more information.
Proposal
We should make these child types inherit from "Resource" in the Aspire Hosting integrations. Redoing what we did in the above 9.1 PRs before we ship 9.1 publicly.
The biggest problem is that we already shipped AddDatabase, AddHub, AddQueue APIs in 9.0, but these APIs return the wrong type. They return the top-level parent Resource when they need to be returning the new child Resource. We can't break these APIs in 9.1, so we will need another way to solve this. In the PRs above, we created WithDatabase, WithHub, etc. but that only worked because the children aren't "Resource"s. Going forward, we want Add APIs that return the new child.
To work around this issue, we will create new Add methods that have a different name. We will remove the newly added With methods and still Obsolete the existing Add methods that were shipped in 9.0.
I can think of 2 patterns for these new Add methods:
AddCosmosDatabase- Add a redundant parent name into the method.AddDatabaseResource- appendResourceto differentiate
When we ship 10.0, we can remove the existing obsolete Add APIs. If we want, at that time we can re-add the AddDatabase, AddHub APIs that return the child resource and use the best method name. The APIs will have been Obsolete for many months by that time, allowing customers to move off the Obsolete APIs.