-
Notifications
You must be signed in to change notification settings - Fork 168
Description
Type of issue
Other (describe below)
Description
Summary
I've noticed that the instructions suggest adding the Redis connection string to the appsettings.json file in the ui and api project. While this approach works, I believe it's unnecessary. Instead, it would be more intuitive to first show the "Configure the App Host project" Section and then proceed to the 'Configure the API with Distributed Caching' section, omitting the connection string part altogether.
My suggestion to rearrange the content in this order stems from the opportunity to demonstrate an example of 'Implicit Service Discovery by Reference'. This would also showcase the simplicity of setting up Redis with Aspire.
What I am suggesting for the tutorial structure
Prerequisites
...
Create the project
...
Configure the App Host project
...
- opportunity to add to this section and mention that implicit service reference makes it so that we no longer need connection strings and only it's service name.
Configure the UI with output caching
... (omit connection string)
- bring up the "cache" service name again above this code section
builder.AddRedisDistributedCache("cache");
Configure the API with distributed caching
... (omit connection string)
- bring up the "cache" service name again above this code section
builder.AddRedisDistributedCache("cache");
Test the app locally
...
Explain Some of the Magic of Aspire (New Section)
- simply state that the ui and api are obtaining the connection strings via implicit reference (refer to app host program.cs file)
- then show a screenshot of the the environment variables for the ui and api in the dashboard (which will be in something along the lines of "connectionStrings__cache")
Page URL
https://learn.microsoft.com/en-us/dotnet/aspire/caching/caching-components
Content source URL
https://github.com/dotnet/docs-aspire/blob/main/docs/caching/caching-components.md
Document Version Independent Id
76ef3cc2-e49d-d8da-b6d0-57fac1e9c332