Skip to content

Use last-one-wins conventions for ExistingResourceAnnotation#7403

Merged
captainsafia merged 2 commits intomainfrom
safia/rm-existing-exceptions
Feb 4, 2025
Merged

Use last-one-wins conventions for ExistingResourceAnnotation#7403
captainsafia merged 2 commits intomainfrom
safia/rm-existing-exceptions

Conversation

@captainsafia
Copy link
Copy Markdown
Contributor

Follow-up to #7249.

@captainsafia captainsafia force-pushed the safia/rm-existing-exceptions branch from 5de413d to 3c17e17 Compare February 4, 2025 16:53
@davidfowl
Copy link
Copy Markdown
Contributor

  1. There's a extension method WithAnnotation that takes a replace behavior.
  2. There's an extension method TryGetLastAnnotation<T>

if (builder.ApplicationBuilder.ExecutionContext.IsPublishMode)
{
builder.Resource.Annotations.Add(new ExistingAzureResourceAnnotation(nameParameter.Resource, resourceGroupParameter?.Resource));
builder.WithAnnotation(new ExistingAzureResourceAnnotation(nameParameter.Resource, resourceGroupParameter?.Resource));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a replace overload.

@captainsafia captainsafia merged commit 1c4496d into main Feb 4, 2025
@captainsafia captainsafia deleted the safia/rm-existing-exceptions branch February 4, 2025 19:48
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 7, 2025
@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants