docs: improve Orleans Aspire integration documentation - #10344
Conversation
- Add per-adapter wiring reference with packages and AddKeyed* calls for Redis, Azure Table Storage, Azure Blob Storage, and ADO.NET - Add provider support matrix showing which features each adapter supports - Document WithOrleansProviderType() override requirement for ADO.NET - Add ADO.NET AppHost and silo snippets with SQL Server example - Add grain directory section with AppHost and silo examples - Add explicit ClusterId/ServiceId example with production guidance - Document streaming limitation (providers don't consume Aspire env vars) - Document how Aspire injects environment variables and provider type inference - Clarify client vs. silo differences for AsClient() - Add reminders section with per-provider AppHost+silo paired examples - Add Aspire.Hosting.SqlServer to AppHost packages - Add ADO.NET/GrainDirectory Orleans packages to Silo.csproj Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Improves the Orleans ↔ Aspire integration documentation by expanding provider wiring guidance and adding new AppHost/Silo snippets for ADO.NET and grain directory configuration, plus additional production guidance.
Changes:
- Added ADO.NET and grain directory AppHost/Silo examples and updated snippet project dependencies.
- Expanded the Aspire integration doc with an adapter wiring reference and a provider support matrix.
- Added production-oriented guidance (stable cluster/service IDs, provider type override notes).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/site/src/content/docs/host/snippets/aspire/Silo/SiloProgram.cs | Adds new silo-side snippet methods for ADO.NET and grain directory scenarios. |
| docs/site/src/content/docs/host/snippets/aspire/Silo/Silo.csproj | Updates snippet project package references to cover additional Orleans/Aspire providers. |
| docs/site/src/content/docs/host/snippets/aspire/AppHost/AppHostExamples.cs | Adds AppHost examples for ADO.NET and grain directory, plus explicit cluster/service ID example. |
| docs/site/src/content/docs/host/snippets/aspire/AppHost/AppHost.csproj | Adds SQL Server hosting package needed by new AppHost snippets. |
| docs/site/src/content/docs/host/aspire-integration.md | Major doc expansion: wiring reference, support matrix, env var details, and production guidance. |
| **Silo example:** | ||
|
|
||
| :::code language="csharp" source="snippets/aspire/Silo/SiloProgram.cs" id="reminders_azure_table_silo"::: | ||
|
|
| <ItemGroup> | ||
| <PackageReference Include="Aspire.Azure.Data.Tables" Version="13.4.6" /> | ||
| <PackageReference Include="Aspire.Microsoft.Data.SqlClient" Version="13.4.6" /> | ||
| <PackageReference Include="Microsoft.Orleans.Persistence.Redis" Version="10.2.1" /> | ||
| <PackageReference Include="Microsoft.Orleans.Reminders.AzureStorage" Version="10.2.1" /> | ||
| <PackageReference Include="Microsoft.Orleans.GrainDirectory.Redis" Version="10.2.1" /> | ||
| <PackageReference Include="Microsoft.Orleans.Clustering.AdoNet" Version="10.2.1" /> | ||
| <PackageReference Include="Microsoft.Orleans.Persistence.AdoNet" Version="10.2.1" /> | ||
| <PackageReference Include="Microsoft.Orleans.Reminders.AdoNet" Version="10.2.1" /> | ||
| <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.8" /> | ||
| </ItemGroup> |
| **Silo registration:** | ||
|
|
||
| ```csharp | ||
| builder.AddKeyedAzureTableServiceClient("clustering"); // key = .AddTables("...") resource name |
…mples WithOrleansProviderType does not exist in Aspire.Hosting.Orleans v13.x. Rewrite ADO.NET examples to use manual Orleans silo configuration instead, reading the connection string injected by Aspire via WithReference(db). Remove the WithOrleansProviderType entry from the extension methods table. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (4)
docs/site/src/content/docs/host/snippets/aspire/Silo/SiloProgram.cs:129
- This ADO.NET grain storage example also uses
System.Data.SqlClientas the invariant. For Orleans 10.x andAspire.Microsoft.Data.SqlClient, this should beMicrosoft.Data.SqlClientto match the supported provider.
siloBuilder.AddAdoNetGrainStorageAsDefault(options =>
{
options.Invariant = "System.Data.SqlClient";
options.ConnectionString = connectionString;
docs/site/src/content/docs/host/snippets/aspire/Silo/SiloProgram.cs:135
- This ADO.NET reminders example uses
System.Data.SqlClientas the invariant. For Orleans 10.x, useMicrosoft.Data.SqlClient(and it matches theAspire.Microsoft.Data.SqlClientcomponent referenced by the snippet project).
siloBuilder.UseAdoNetReminderService(options =>
{
options.Invariant = "System.Data.SqlClient";
options.ConnectionString = connectionString;
docs/site/src/content/docs/host/snippets/aspire/Silo/SiloProgram.cs:122
- The ADO.NET example uses the deprecated/incompatible provider invariant
System.Data.SqlClient. With Orleans 10.x packages (10.2.1 here) the docs recommendMicrosoft.Data.SqlClientand the project referencesAspire.Microsoft.Data.SqlClient, so this line will misconfigure SQL Server in current versions.
This issue also appears in the following locations of the same file:
- line 126
- line 132
siloBuilder.UseAdoNetClustering(options =>
{
options.Invariant = "System.Data.SqlClient";
options.ConnectionString = connectionString;
docs/site/src/content/docs/host/aspire-integration.md:322
- This suggests using
.WithOrleansProviderType("X")to override provider type inference, but earlier in the same doc you state there is no public API to override this inference. IfWithOrleansProviderTypeis not a public API (it does not appear in Aspire docs), this line will mislead readers.
### Provider type inference
Aspire infers the provider type name from the .NET class name of the resource by stripping the `"Resource"` suffix:
- `RedisResource` → `Redis`
- `AzureBlobStorageResource` → `AzureBlobStorage`
- `AzureTableStorageResource` → `AzureTableStorage`
- `SqlServerDatabaseResource` → `SqlServerDatabase` (incorrect for Orleans ADO.NET — no public override API; configure ADO.NET providers manually in the silo instead)
Use `.WithOrleansProviderType("X")` to override the inferred name when the C# class name doesn't match what Orleans expects.
- Use Microsoft.Data.SqlClient invariant in ADO.NET Orleans snippet - Use AddKeyedAzureTableServiceClient in reminders snippet - Remove outdated WithOrleansProviderType guidance from docs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (4)
docs/site/src/content/docs/host/snippets/aspire/Silo/Silo.csproj:25
- The snippets include
.WithReminders(redis)(Redis reminders) and.WithClustering(reminders)(Azure Table Storage clustering), but this project file is missing the corresponding Orleans provider packages. Without them, Orleans will fail at runtime with "Could not find Reminders/Clustering provider..." when those examples are run.
<PackageReference Include="Aspire.Azure.Data.Tables" Version="13.4.6" />
<PackageReference Include="Aspire.Microsoft.Data.SqlClient" Version="13.4.6" />
<PackageReference Include="Microsoft.Orleans.Persistence.Redis" Version="10.2.1" />
<PackageReference Include="Microsoft.Orleans.Reminders.AzureStorage" Version="10.2.1" />
<PackageReference Include="Microsoft.Orleans.GrainDirectory.Redis" Version="10.2.1" />
<PackageReference Include="Microsoft.Orleans.Clustering.AdoNet" Version="10.2.1" />
<PackageReference Include="Microsoft.Orleans.Persistence.AdoNet" Version="10.2.1" />
<PackageReference Include="Microsoft.Orleans.Reminders.AdoNet" Version="10.2.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.8" />
docs/site/src/content/docs/host/aspire-integration.md:307
- This provider-variable table is missing the
ServiceKeyenvironment variable for external reminders resources. The reminders provider builders readconfigurationSection["ServiceKey"](e.g.,Orleans.Reminders.AzureStorage/Orleans.Reminders.Redis), so Aspire must injectOrleans__Reminders__ServiceKeyfor.WithReminders(resource)to work.
| `.WithGrainStorage("Default", blobs)` | `Orleans__GrainStorage__Default__ServiceKey` | `grainstate` |
| `.WithMemoryGrainStorage("Default")` | `Orleans__GrainStorage__Default__ProviderType` | `Memory` |
| `.WithReminders(tables)` | `Orleans__Reminders__ProviderType` | `AzureTableStorage` |
| `.WithMemoryReminders()` | `Orleans__Reminders__ProviderType` | `Memory` |
| `.WithGrainDirectory("dir", redis)` | `Orleans__GrainDirectory__dir__ProviderType` | `Redis` |
docs/site/src/content/docs/host/aspire-integration.md:229
- This note attributes the streaming limitation to Orleans not consuming Aspire-injected configuration, but Orleans does apply named
Orleans:Streamingsubsections (seeDefaultSiloServices.ApplyConfiguration/DefaultClientServices.ApplyConfiguration) and streaming providers read keys likeServiceKey. IfWithStreaming(...)isn't working yet, the limitation is likely in Aspire's injection/provider-type inference rather than Orleans ignoring configuration. Rewording will prevent a misleading explanation.
> [!NOTE]
> Streaming providers aren't supported via Aspire environment variable injection as of Orleans 8.x. The `WithStreaming` AppHost API exists, but Orleans streaming providers don't yet consume Aspire-injected configuration. Use `WithMemoryStreaming` for local development and configure streaming providers manually for production.
docs/site/src/content/docs/host/aspire-integration.md:185
- The ADO.NET section implies that registering an Aspire SQL client is part of Orleans ADO.NET provider wiring, but the corresponding silo example configures Orleans using a connection string and does not use the registered client. Orleans ADO.NET clustering/storage/reminders options take
ConnectionString/Invariantdirectly, soAddKeyedSqlServerClientis optional (only needed if the app itself uses the DB via the Aspire component). Clarifying this avoids readers thinking Orleans will resolve a keyed SQL client automatically.
**Silo package:** `Aspire.Microsoft.Data.SqlClient` (SQL Server), `Aspire.Npgsql` (PostgreSQL), or `Aspire.MySqlConnector` (MySQL)
**Silo registration:**
```csharp
Improves the Aspire integration docs with adapter wiring reference, provider support matrix, ADO.NET coverage, and production guidance.
Microsoft Reviewers: Open in CodeFlow