Skip to content

Conversation

alistairmatthews
Copy link
Contributor

@alistairmatthews alistairmatthews commented Sep 23, 2025

Summary

Adds a new section to the Integrations Overview article that contrasts and clarifies the behavior of methods starting with "Add" from those starting with "With". Without this clarification, developers may pass unexpected object types to consuming projects when the call WithReference.

Fixes #4736


Internal previews

📄 File 🔗 Preview link
docs/fundamentals/integrations-overview.md .NET Aspire integrations overview

@Copilot Copilot AI review requested due to automatic review settings September 30, 2025 17:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds documentation to clarify the distinction between Add* and With* extension methods in Aspire hosting integrations. The changes help developers understand the different behaviors and return types of these methods to avoid passing incorrect resource objects when using WithReference.

Key changes:

  • Added a new section explaining the pattern and purpose of Add* vs With* methods
  • Included code examples demonstrating common pitfalls and correct usage patterns
  • Added important callout about passing correct resource objects to client integrations

@IEvangelist IEvangelist enabled auto-merge (squash) September 30, 2025 17:44
@IEvangelist
Copy link
Member

Hey @copilot please correct these build errors:

Line 709: [Warning] Cross reference not found: 'Aspire.Hosting.EventingExtensions.OnInitializeResource*'.
Line 710: [Warning] Cross reference not found: 'Aspire.Hosting.EventingExtensions.OnBeforeResourceStarted*'.
Line 711: [Warning] Cross reference not found: 'Aspire.Hosting.EventingExtensions.OnConnectionStringAvailable*'.
Line 712: [Warning] Cross reference not found: 'Aspire.Hosting.EventingExtensions.OnResourceEndpointsAllocated*'.
Line 713: [Warning] Cross reference not found: 'Aspire.Hosting.EventingExtensions.OnResourceReady*'.

Simply replace these references in the docs/whats-new/dotnet-aspire-9.4.md file with the following xrefs:

<xref:Aspire.Hosting.DistributedApplicationEventingExtensions.OnInitializeResource*>
<xref:Aspire.Hosting.DistributedApplicationEventingExtensions.OnBeforeResourceStarted*>
<xref:Aspire.Hosting.DistributedApplicationEventingExtensions.OnConnectionStringAvailable*>
<xref:Aspire.Hosting.EventingExtensions.OnResourceEndpointsAllocated*>
<xref:Aspire.Hosting.DistributedApplicationEventingExtensions.OnResourceReady*>

@IEvangelist IEvangelist merged commit d5552e0 into dotnet:main Sep 30, 2025
6 of 7 checks passed
@alistairmatthews alistairmatthews deleted the contrast-with-and-add-methods-on-integrations branch October 2, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify the behavior of Add... integration extension methods and contrast them with With... methods
2 participants