C3D.Extensions.Aspire.Fluent
0.2.6
dotnet add package C3D.Extensions.Aspire.Fluent --version 0.2.6
NuGet\Install-Package C3D.Extensions.Aspire.Fluent -Version 0.2.6
<PackageReference Include="C3D.Extensions.Aspire.Fluent" Version="0.2.6" />
<PackageVersion Include="C3D.Extensions.Aspire.Fluent" Version="0.2.6" />
<PackageReference Include="C3D.Extensions.Aspire.Fluent" />
paket add C3D.Extensions.Aspire.Fluent --version 0.2.6
#r "nuget: C3D.Extensions.Aspire.Fluent, 0.2.6"
#addin nuget:?package=C3D.Extensions.Aspire.Fluent&version=0.2.6
#tool nuget:?package=C3D.Extensions.Aspire.Fluent&version=0.2.6
C3D.Extensions.Aspire.Fluent
Key Functions
- Environment-based Configuration Easily apply different configurations depending on the hosting environment (e.g., Development, Staging, Production).
- Operation Mode Detection Adjust host behavior based on the current operation mode, such as Run, Publish, or Inspect.
- Test Environment Awareness
Automatically detect if the host is running under test conditions (by checking for the presence of the
Aspire.Hosting.Testing
assembly in the call stack) and apply test-specific settings.
Usage Example
Suppose you want to configure services differently for development and production:
var sqldb = builder.WhenDevelopment(b => b.AddSqlServer("sql").AddDatabase("sqldb"));
builder.AddProject<Projects.MyWebApp>("webapp")
.WhenDevelopment(r => r.WithReference(sqldb!, "sqldb")
.WaitFor(sqldb!),
r => r.WithEnvironment("ConnectionString_sqldb","data source=(localdb)\mssqllocaldb;initial catalog=webapp;integrated security=True;MultipleActiveResultSets=True;App=webapp"));
For most of the methods, there is an else case (which is optional), and extension methods for IResourceBuilder
and IDistributedApplicationBuilder
You can also nest methods, e.g. WhenUnderTest
inside the lambda of WhenDevelopment
.
If you want to only use the 'else' case, you can simply return the resourceBuilder or null in the match function.
var sqldb = builder.WhenProduction(_ => null, b => b.AddSqlServer("sql").AddDatabase("sqldb"));
builder.AddProject<Projects.MyWebApp>("webapp")
.WhenProduction(r => r,
r => r.WithReference(sqldb!, "sqldb")
.WaitFor(sqldb!));
In the case of UnitTesting, there are explicit WhenNotUnderTest
methods which read more cleanly than WhenUnderTest(r=>r, r=>r.... )
.
Note: For detailed API documentation and advanced usage, refer to the source code or inline XML comments within the project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Aspire.Hosting (>= 9.2.0)
-
net9.0
- Aspire.Hosting (>= 9.2.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on C3D.Extensions.Aspire.Fluent:
Package | Downloads |
---|---|
C3D.Extensions.Aspire.VisualStudioDebug
Assembly Version: 0.1.0.0 File Version: 0.1.43.15317 Informational Version: 0.1.43+d53b3e62e2 Build Configuration: Release |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.6 | 250 | 5/12/2025 |