Skip to content

Add IDistributedApplicationComponentWithConnectionString to app model - #130

Merged
David Fowler (davidfowl) merged 2 commits into
mainfrom
davidfowl/generic-connectionstring-export
Oct 9, 2023
Merged

David Fowler (davidfowl) merged 2 commits into
mainfrom
davidfowl/generic-connectionstring-export

Conversation

@davidfowl

@davidfowl David Fowler (davidfowl) commented Oct 8, 2023 •

Copy link
Copy Markdown
Collaborator
  • With the latest changes to the app model we have landed on a generic way for resources in the app model to express that they can provide a connection string to a dependency that requests it. This change introduces that abstraction (assuming no extra arguments) and exposes a WithReference method that handles injecting the right connection information based on the component name.

PS: The azure components will get the same treatment once we merge this change #65

- With the latest changes to the app model we have landed on a generic way for resources in the app model to express that they can provide a connection string to a dependency that requests it. This change introduces that abstraction (assuming no extra arguments) and exposes a WithReference method that handles injecting the right connection information based on the component name.
@mitchdenny

Copy link
Copy Markdown
Member

I like it overall How do you envisage this working for resource types with "sub-things". For example a Postgres where the connection string should really specify the specific database?

Also on naming how about IDistributedApplicationComponentWithConnectionString. Too verbose? Should we consider renaming IDistributedApplicationComponentWithEnvironment?

@davidfowl David Fowler (davidfowl) changed the title Add IConnectionStringProvider to app model Add IDistributedApplicationComponentWithConnectionString to app model Oct 9, 2023
@davidfowl

Copy link
Copy Markdown
Collaborator Author

I like it overall How do you envisage this working for resource types with "sub-things". For example a Postgres where the connection string should really specify the specific database?

I think those become resources instead of arguments to WithX*. It makes things much easier to model.

Also on naming how about IDistributedApplicationComponentWithConnectionString. Too verbose? Should we consider renaming IDistributedApplicationComponentWithEnvironment?

Done for consistency.

@davidfowl
David Fowler (davidfowl) enabled auto-merge (squash) October 9, 2023 00:33
@davidfowl
David Fowler (davidfowl) merged commit e962473 into main Oct 9, 2023
@davidfowl
David Fowler (davidfowl) deleted the davidfowl/generic-connectionstring-export branch October 9, 2023 00:48
@danmoseley Dan Moseley (danmoseley) added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Nov 16, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2024
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.

3 participants